Home Axis labels are cut off when saving MATLAB figure
Reply: 0

Axis labels are cut off when saving MATLAB figure

user1115
1#
user1115 Published in May 27, 2018, 3:36 am

Consider the following MWE with produces a figure:

clear 
close all

fig1 = figure(1);
set(gca,'xscale','log')
set(gca,'yscale','log')
xlabel('Frequency (Hz)')
ylabel('Amplitude (dB)')
set(gca,'FontUnits','points',...
'FontWeight','normal',...
'FontSize',10,...
'FontName','Times',...
 'Units','normalized');

PaperW = 16;
PaperH = 7.5;
fig1.Units = 'centimeters';
fig1.Position = [20 10 PaperW PaperH];
fig1.PaperUnits = 'centimeters';
fig1.PaperPosition = [0 0 PaperW PaperH];

print(fig1,'fig1.png','-dpng','-r300')

I'm trying to save this as a .png file using print. Additionally, I want the saved image to be 16cm by 7.5cm. I specified this using PaperW and PaperH (the width and height).

The problem is, the bottom of the xlabel text is cut off. Why is this happening? And how can I solve this problem?

Zoomed in on the xlabel. Notice how the bottom of the q and y are cut off.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308174 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO