MATLAB: Text label in plot/graph

text label in figuretext;

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??

Best Answer

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')
Related Question