필터 지우기
필터 지우기

y-axis font size won't reduce when saved as .jpeg

조회 수: 3 (최근 30일)
Taylor Thomson
Taylor Thomson 2022년 6월 2일
답변: Nihal Reddy 2023년 2월 16일
I'm using a 212 subplot and my y-axes titles are overlapping.
When using 'FontSize', my y axis font is small in the figure produced by the code, but when saved to a .jpeg it overlaps again. Reducing the fontsize further does not help.
Code and photos of .jpeg (1) and figure output (2) below
1
2
p=plot(Results.N_mac);set(p,'color',c1(ic(jj),:),'linewidth',1.5)
ylabel('Sediment Layer Nutrients ( mmol NH4+ m2 )','FontSize',7.5)
xlabel('Time ( days )')
title('(a)')
hold on
subplot(212)
p=plot(Results.N_MPB);set(p,'color',c1(ic(jj),:),'linewidth',1.5)
ylabel('Water Column Nutrients ( mmol N m2 )','FontSize',7.5)
xlabel('Time ( days )')
title('(b)')
hold on
  댓글 수: 3
Mathieu NOE
Mathieu NOE 2022년 6월 2일
maybe silly but why not put the main text as title (or legend) and keep only the units and ref values in the y label ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Nihal Reddy
Nihal Reddy 2023년 2월 16일
I understand that the font size of the y axis in the figure is not consistent when it is saved as the JPEG image.
Use the "saveas" function should be able to resolve this. For example:
saveas(gcf,'figure1.png');
The root cause is that the "File - Save As" from the figure window GUI does not preserve some settings.
This is because "File->Save As" from the figure GUI and the "saveas" command don't do the same thing. This is a longstanding behavior in MATLAB.
"File->Save As" tries to make sure the exported figure "looks good", and part of that logic is to
1. export it at screen resolution (DPI), and
2. make sure content isn't too small (In this case, the small font size is bumped up to 8pts)
Whereas the "saveas command” exports images at 150 DPI resulting in a larger output file. It does not have that logic to "fix" too small content.

카테고리

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

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by