yyaxis not working in app designer.

25 views (last 30 days)
David Levesque
David Levesque on 7 Nov 2019
Edited: Adam Danz on 8 Apr 2020
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 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
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)

Community Treasure Hunt

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

Start Hunting!