yyaxis not working in app designer.

8 views (last 30 days)
Hi, I'm trying to plot a line on both the left and right side of a UIAxes in App Designer with the command yyaxis(myAxes, 'left'). I stripped down the problem to its most simple expression, a single figure with a UIAxes in it.
yyaxis.png
When I click on the graph I get that error:
Warning: Error occurred while executing the listener callback for event WindowMousePress defined for class
matlab.ui.Figure:
Unrecognized method, property, or field 'processFigureHitObject' for class 'matlab.ui.control.UIAxes'.
Error in matlab.graphics.internal.YYAxisEventManager
Error in matlab.graphics.internal.YYAxisEventManager
The code in the startupFcn is:
yyaxis(app.UIAxes, 'left');
x = pi:0.1:3*pi;
y = sin(x);
plot(app.UIAxes,x,y);
I use Matlab R2019b.
Anyone got an idea?
  4 Comments
Adam Danz
Adam Danz on 8 Nov 2019
Edited: Adam Danz on 15 Nov 2019
Tested in r2019b on my end and it threw the same warning (not an error). I didn't have more time to look into it.
The warning occurs when you click on an object within the UIAxis but not when you click on the axis background itself.
Adam Danz
Adam Danz on 15 Nov 2019
Mark Gerber 's answer moved here as a comment.
I am experiencing similar problems.

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 15 Nov 2019
Edited: Adam Danz on 8 Apr 2020
The problem (r2019b)
A warning is thrown when clicking on UIAxis objects that were plotted with yyaxis. To recreate the problem:
% (in r2019b)
fh = uifigure();
uia = uiaxes(fh);
yyaxis(uia, 'left');
plot(uia,rand(1,5),'-o');
yyaxis(uia, 'right');
plot(uia,rand(1,5),'-o');
% Now, click on the x or y axes or any of the line objects
Temporary work-around
This has been reported to Tech Support (case #03884386) and hopefully will be addressed in future releases. If the warning is bothersome, you can suppress it (and any other warnings caused by a callback error) by executing this line of code before or immediately after the yyaxis plot is created.
% in app designer, this can go in your startupFcn
warning('off','MATLAB:callback:error')
to turn the warning back on (which you should do)
% in app designer, this can go in your UIFigureCloseRequest function
% otherwise, it should be a part of your figure's CloseRequestFcn
warning('on','MATLAB:callback:error')
Update: The bug is no longer a problem in r2020a.
  2 Comments
Nils
Nils on 8 Apr 2020
I am facing the same problem when clicking on the UIAxes containing a yyaxis in my App using R2019b (Update 5) only that my App does not respond to any click afterwards and the command window does not respond either. I am using a timerclass object that updates an animated line in the UIAxes which works without using yyaxis but also showing the abovementioned warning from time to time. My guess is that the continuous timer execution results in the lack of response. I could circumvent the issue by using disableDefaultInteractivity(ax).
Are there any news concerning a bug fix? I could not find any bug report online.
Adam Danz
Adam Danz on 8 Apr 2020
"Are there any news concerning a bug fix? "
Yes, I just tested it in 2020a and the bug seems to be gone. If you can upgrade, that would be the easiest solution.

Sign in to comment.

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!