Plot title disappears if ymax < 1
Mostrar comentarios más antiguos
My plot titles are disappearing if ymax is less than 1, presumably because the " X 10^-2" bit ends up in the area where the title goes. It is not affected by the length (number of characters) of the plot title. I have only noticed this since I started shrinking my plots vertically from the default size so that three of them will fit on one page in a word document file.
The code for shrinking vertically:
currentSize = get(gcf, 'Position');
set(gcf, 'Position', [currentSize(1) currentSize(2) currentSize(3) 280])
My current workaround is to increase the plot window size, add the title, then reduce the plot size back:
figurePosition = get (gcf, 'Position');
set (gcf, 'Units', 'normalized', 'Position', [0,0,1,1]);
% add plot titles etc here
set (gcf, 'Units', 'pixels', 'Position', figurePosition);
This works for long plot titles, even if the text overlaps the " X 10^-2" bit.
I am using R2008b.
Respuestas (1)
Walter Roberson
el 16 de Jul. de 2015
If you set the axis ylabel property explicitly, then the power of 10 will not be printed.
curytick = get(gca, 'YTick');
set(gca, 'YLabel', cellstr(num2str(curytick(:))))
The (:) is important: the ticks are usually a row vector and they need to be a column vector for num2str() to produce the correct output format.
2 comentarios
Charles
el 16 de Jul. de 2015
Walter Roberson
el 16 de Jul. de 2015
Yes, sorry, should have been YTickLabel
Categorías
Más información sobre Graphics 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!