y-axis font size won't reduce when saved as .jpeg
4 views (last 30 days)
Show older comments
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 Comments
Mathieu NOE
on 2 Jun 2022
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 ?
Mathieu NOE
on 3 Jun 2022
another possible solution
Answers (1)
Nihal Reddy
on 16 Feb 2023
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.
0 Comments
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!