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

7 ビュー (過去 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 Center および File ExchangePrinting and Saving についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by