필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
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?

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by