How to definie FontSize for Ticks on Axes when printing figures to files

2 ビュー (過去 30 日間)
Jesper Bjerregaard
Jesper Bjerregaard 2021 年 3 月 8 日
Hi,
I'm currently working on a figure generation tool for an app I'm writing.
In that regard, I'm trying to change the size of the ticks on the axes, but every time i save the figure, the font size of the ticks changes to a default value.
Is there a way to prevent this?
Code below:
F=figure('PaperPositionMode','manual','visible',false);
AX = gca;
% PLOT SOME STUFF (omitted here, since no relevance)
F.Resize = 'off';
F.Units = 'points';
F.PaperUnits = 'points';
AX.Units = 'points';
AX.Clipping = 'on';
AX.DataAspectRatioMode = 'auto';
AX.PositionConstraint = 'innerposition';
AX.FontSizeMode = 'manual';
% CHANGE PROPERTIES OF AX AND F
AX.XAxis.FontSize = 32;
% When executing next line, the font size of the ticks on the XAxis will change back to 10.
print(F,'CurrentFigure.png','-dpng','-r0');
% Changing AX.FontSize will not solve the problem.
% Changing interpreter will not solve the issue.
% Changing renderer will not solve the issue.
Basically I've read through every single property of the figure class, the axes class and the numeric-ruler class. I can't find any option that keeps the font size of the ticks when saving the figure to a file.
If I use the exportgraphics (https://se.mathworks.com/help/matlab/ref/exportgraphics.html) function instead of the print function, the tick size stays the same. But exportgraphics crops the image, which compleatly ruins the purpose of the program in this case. So I can't use that function.
Any suggestions would be most welcome.
Regards.

回答 (1 件)

Jan
Jan 2021 年 3 月 8 日
Did you try export_fig already?
  1 件のコメント
Jesper Bjerregaard
Jesper Bjerregaard 2021 年 3 月 8 日
Yes. Unfortunately it doesn't solve the issue either.

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

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by