Borrar filtros
Borrar filtros

Text label in plot/graph

2 visualizaciones (últimos 30 días)
premraj
premraj el 2 de Sept. de 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??

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 2 de Sept. de 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 comentario
premraj
premraj el 2 de Sept. de 2011
thanks oleg for ur response!!!It worked!!!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by