Mostrar comentarios más antiguos
Is possible put a text in a determinated position, for example, at the top left?
Respuesta aceptada
Más respuestas (4)
Jan
el 6 de Feb. de 2011
FigH = figure;
AxesH = axes('Parent', FigH, ...
'Units', 'normalized', ...
'Position', [0, 0, 1, 1], ...
'Visible', 'off', ...
'XLim', [0, 1], ...
'YLim', [0, 1], ...
'NextPlot', 'add');
TextH = text(0,1, 'Top left', ...
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'top');
Now you can inspect the properties with "get(TextH)" or "set(TextH)" for further adjustments.
Sometimes a UICONTROL('Style', 'text') is easier, because it does not need the invisible full-figure AXES object.
RonE
el 4 de Oct. de 2018
I find the documentation on 'text' to be nearly useless in this matter. The following places text at the top left of the graph.
ylimits = ylim;
ymax = ylimits(2);
vert_spacing = ymax/47; %may have to experiment with this #
text(10, ymax-vert_spacing*1, 'Line 1');
text(10, ymax-vert_spacing*2, 'Line 2');
...
Vieniava
el 6 de Feb. de 2011
Editada: John Kelly
el 26 de Feb. de 2015
1 voto
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!