How to add text label to plot referenced to the second y-axis
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Mischa Kim
el 16 de Sept. de 2016
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')
1 comentario
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!