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

3 次查看(过去 30 天)
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