How to add text label to plot referenced to the second y-axis
12 ビュー (過去 30 日間)
古いコメントを表示
I would like to add a text label to my plotyy figure with the y-coordinate of the text(x,y,'string') referenced to the second y-axis. For example, I would like to have a text label at x=1 and y-axis(1)=3000 (text(1,3000,'string')) and another text label at x=2 and y-axis(2)=500, the second instance should be referenced to the second y-axis not the first.
I have tried,
[ax1,h1,h2]=plotyy(x1,y1,x2,y2);
text(ax1(2),xtext,ytext,'string')
"Error using text"
"First two or three arguments must be numeric doubles."
no luck yet, any suggestions would be appreciated. I do not have R2016 or I would have tried yyaxis left and yyaxis right.
0 件のコメント
回答 (1 件)
Mischa Kim
2016 年 9 月 16 日
Mark, what about something like
x = 0:0.01:10;
y1 = exp(-0.05*x).*sin(x);
y2 = exp(-0.5*x).*sin(10*x);
[ax, h1, h2] = plotyy(x, y1, x, y2, 'plot');
text(x(1), y1(1),'string 1')
text(x(end),y2(1),'string 2')
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!