placing text on the figure while using scatter function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
sermet
am 18 Feb. 2016
Kommentiert: Walter Roberson
am 19 Feb. 2016
figure(1); hold on
scatter(1, 1, 100, 'k', 'o')
scatter(1, 2, 100, 'k', '+')
h = legend('SV1-SV7', 'Plus', 'Location', 'NorthEast');
set(h, 'FontSize', 14)
axis([0 3 0 3])
How can I add a text into this figure right below the legend box? I tried to place with location specified by the point (x,y) but axis data is not constant all the time so each time location of the text is changing w.r.t. axis data. Is there any way to place text right below the legend all the time (i.e. fixed location on the figure)?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 18 Feb. 2016
You can set the Units for text() to be 'normal', and set the Position to have a X coordinate of 1, and set the Horizontal centering to have the text go to the left of that point. This will stick to the right margin if the xlim changes (such as if more data is added.)
2 Kommentare
Walter Roberson
am 19 Feb. 2016
th = text(1,.2,'hello','units','normal','horizontalalignment', 'right');
shows up 1/5 of the way up from the bottom of the plot, at the right hand side, completely inside the drawing axes but the right side of the text essentially touching the axes. It will stay in that relative position even if you explicitly or implicitly change the xlimits or ylimits.
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!