How can I put a label on the right side of a plot when I use PLOTYY?

7 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
Here is an example showing the commands that are needed to put a label on the right (and left) side of a plot after using PLOTYY:
x = 0:0.1:10;
y1 = cos(x);
y2 = sin(x);
[ax,h1,h2] = plotyy(x,y1,x,y2);
axes(ax(1))
ylabel('cosine')
axes(ax(2))
ylabel('sine')
If you cut and paste this code into the MATLAB Command Window, you will see a figure that has SIN(x) and COS(x) plotted on the same graph with a label 'sine' on the left and 'cosine' on the right.

More Answers (0)

Categories

Find more on Two y-axis in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!