Filter löschen
Filter löschen

Text label in plot/graph

2 Ansichten (letzte 30 Tage)
premraj
premraj am 2 Sep. 2011
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??

Akzeptierte Antwort

Oleg Komarov
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')
  1 Kommentar
premraj
premraj am 2 Sep. 2011
thanks oleg for ur response!!!It worked!!!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by