MATLAB cropping colorbar text - how to fix?

26 ビュー (過去 30 日間)
Kobye
Kobye 2013 年 12 月 31 日
編集済み: Image Analyst 2014 年 1 月 1 日
The problem looks as in the attached image. The exponent in the colorbar scale indicator (i.e. 10^9 symbol next to the colorbar) is being cropped out both in the MATLAB figure window (although this is fixable by stretching the window) but more crucially when I print my image to a file.
What should I do to resolve this issue, and does the below code give others the same issue? (I've looked in the archive and not found a similar problem)
figure(1)
pcolor(peaks.*1e9)
shading interp
colorbar('location','EastOutside')
set(gcf,'PaperUnits','inches');
set(gcf,'PaperSize', [22.4 4]);
set(gcf,'PaperPosition',[0.2 0.2 21.4 3]);
set(gcf,'PaperPositionMode','Manual');
set(gca,'FontSize',16);
set(gca,'FontWeight','Bold');
axis off
delete('fig1.pdf');
print(gcf,'-dpdf','-r150','fig1.pdf');

回答 (2 件)

Image Analyst
Image Analyst 2013 年 12 月 31 日
編集済み: Image Analyst 2014 年 1 月 1 日
Try making the font size just a little bit smaller. Or else try set(gca, 'InnerPosition', newSize) to see if you can make it a bit bigger container.
  2 件のコメント
Sean de Wolski
Sean de Wolski 2013 年 12 月 31 日
That's what it looks like to me, the container is over constrained. Try increasing the figure's position width&height to match the PaperPosition's.
Kobye
Kobye 2014 年 1 月 1 日
Thanks for the suggestions, however unfortunately neither solution worked for me. It's a bit of a strange one.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2014 年 1 月 1 日
You can eliminate the multiplier if you set YTickLabel yourself.
cbaxis = ... whatever to find the axes of the color bar
set(cbaxis, 'YTickLabel', cellstr( str2num( reshape( get(cbaxis, 'YTick'), [], 1), '%.1e' ) ) )

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by