Plot title disappears if ymax < 1
显示 更早的评论
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.
回答(1 个)
Walter Roberson
2015-7-16
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!