MATLAB FontSize wrong when figure height is large

1 回表示 (過去 30 日間)
Kristian Sørensen
Kristian Sørensen 2015 年 8 月 20 日
編集済み: Kristian Sørensen 2015 年 9 月 1 日
When exporting figures via print in MATLAB 2015a (both on Mac and Windows), the FontSize property is ignored when the figure height exceeds a certain threshold (30 cm on my Mac, 28 cm on my Windows computer).
clear; close all; clc;
w = 20;
x = [5 10 20 22 25 28 29 30 35 40 50];
y = [11.98 12 11.99 11.99 11.99 11.99 12.33 12.75 14.88 17 21.25];
for h = [5 10 30 40]
hFigure = figure;
plot(x,y,'o-');
xlabel('Figure height [cm]','FontSize',12);
ylabel('Actual font size [pt]','FontSize',12);
hFigure.Units = 'centimeters';
hFigure.PaperUnits = 'centimeters';
hFigure.PaperPosition = [0 0 w h];
hFigure.PaperSize = [w h];
title(sprintf('This figure: width %d, height %d',w,h),'FontSize',12)
print(sprintf('w%dh%d.pdf',w,h),'-dpdf')
end
When inspecting the figures in a vector graphics program such as Inkscape or Illustrator, the font size is correct when the height is smaller than a certain threshold, but at larger heights, the actual font size increases linearly. The exact slope and onset appears to be system dependent, and thus more difficult to correct for. The phenomenon is independent of width.
Such large figures are relevant e.g. on posters. Does anyone know how it can be resolved?

採用された回答

Richard Quist
Richard Quist 2015 年 8 月 21 日
Kristian,
I'm fairly certain that the problem you describe is this issue: Bug Report 1196095
It is related to scaling that occurs when the requested output size exceeds the screen size. Until this issue is fixed, my recommendation is to print to a PDF file at a smaller size that matches the aspect ratio of your poster, and then scale the PDF to your final output size when printing from Adobe Reader or another PDF viewer. As long as MATLAB produces "true" vector format (and not a vector format that contains an embedded image), the content should scale fairly well.
Hope that helps.
  1 件のコメント
Kristian Sørensen
Kristian Sørensen 2015 年 9 月 1 日
編集済み: Kristian Sørensen 2015 年 9 月 1 日
I agree that this bug is already reported. I hope MathWorks will fix it soon, but until then, your proposed workaround should work. Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by