placing text on the figure while using scatter function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
sermet
le 18 Fév 2016
Commenté : Walter Roberson
le 19 Fév 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 commentaires
Réponse acceptée
Walter Roberson
le 18 Fév 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 commentaires
Walter Roberson
le 19 Fév 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!