Problem with a yyaxis plot
8 views (last 30 days)
Show older comments
Bryan Andrade Andrade
on 13 Dec 2019
Hi, i need your help: i´m trying to plot this code:
x = linspace(0,25); y = sin(x/2); yyaxis left plot(x,y);
I found this code in mathworks help, i dont know why i can´t run it. The error says:
Error using yyaxis
Axes argument must be a Cartesian Axes of type matlab.graphics.axis.Axes
Help me please.... how i could fix it? its my matlab problem or the code is wrong i don´t know help me...
0 Comments
Accepted Answer
Adam Danz
on 13 Dec 2019
Edited: Adam Danz
on 17 Dec 2019
You're missing a semicolon
x = linspace(0,25); y = sin(x/2); yyaxis left; plot(x,y);
% here ^
Or, better yet, use separate lines which greatly increases readability and error detection.
x = linspace(0,25);
y = sin(x/2);
yyaxis left %no semicolon needed this time
plot(x,y);
The error message appeared becaues Matlab interpreted your code as providing an axes input: yyaxis(ax,___)
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!