How to fix a text's location on a plot, without giving text's axises?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I would like to add a text on my plots. I am using the text(x,y,textword) function to do so. But I have a problem about fixing them at the corner of my plot. Because I have 20sets of data that I need to plot, each of them has slightly different x&y scales. Thus I cannot give a 'certain' x and y location to my textwords. If there a way I can tell MATLAB to display the text on the top right corner of each of plot, without per-define the text's location?
thanks.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 17 Sep. 2016
You can get xlim and ylim, then set x and y accordingly.
xl = xlim();
yl = ylim();
xWidth = xl(2)-xl(1);
yHeight = yl(2)-yl(1);
% Set x 90% of the way over.
x = xl(1) + 0.90 * xWidth;
% Set y 5% of the way up from the bottom.
y = yl(1) + 0.05 * yHeight;
text(x, y, 'Here I am!');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!