How to label the secondary axis of a graph

조회 수: 48 (최근 30일)
Earle Jamieson
Earle Jamieson 2012년 5월 13일
Hi,
This is a simple question, but I can't seem to find the answer to it anywhere... how do I add a label to the secondary (RHS) axis of a graph made using plotyy? I am curretly using ylabel but of course only one axis can be labelled that way.
Thanks

채택된 답변

Oleg Komarov
Oleg Komarov 2012년 5월 13일
The 4th syntax of ylabel shows explixitly than you can 'refer' to a specific axis.
Which means that you have to use the last syntax of plotyy to retrieve the handles to both axes and then feed it to ylabel. You can also set the labels as shown in the example (of the documentation).
An example with ylabel
figure
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot');
ylabel(AX(1),'Something')
ylabel(AX(2),'Else')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by