Text label in plot/graph
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I want to place a formatted text on the right side of my contour plot.
sample text is shown below :
Rotation: 0 Elevation: 90 Orientation: 0 Spec Range: 241.9877
This text value represents the parameters of the graph plotted.So whenever somebody resized the figure , text position shall be adjusted so that the text won't overlap with the graph.
Can anyone help me to sove this issue??
0 Kommentare
Akzeptierte Antwort
Oleg Komarov
am 2 Sep. 2011
Contour example:
[X,Y] = meshgrid(-2:.2:2,-2:.2:3);
Z = X.*exp(-X.^2-Y.^2);
[C,h] = contour(X,Y,Z);
set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2)
colormap cool
% Place text label
text(1.9,2.5,'Rotation: 0 Elevation: 90 Orientation: 0 Spec Range: 241.9877',...
'Horiz','right','Vert','Bottom')
Alternatively, vertically stacked labels:
lbl = {'Rotation', 'Elevation', 'Orientation', 'Spec Range';
0 , 90 0 241.9877};
cs = sprintf('%-11s: %10.4f\n',lbl{:});
text(1.9,2.9,cs,'FontN','FixedWidth','Horiz','right','Vert','top')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Labels and 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!