我有这段代码:
fig = figure('visible','on');
plot(0:0.1:2*pi,sin(0:0.1:2*pi))
grid on
grid minor
set(gca,'FontSize',20,'xtick',0:0.5:2*pi)
saveas(fig,'plot','png')
当保存图表时,它没有最大化,因此刻度数字相互挤压。 我使用了this question的解决方案,但它不起作用:
fig = figure('visible','on');
plot(0:0.1:2*pi,sin(0:0.1:2*pi))
grid on
grid minor
set(gca,'FontSize',20,'xtick',0:0.5:2*pi)
set(gcf,'units','normalized','outerposition',[0 0 1 1])
saveas(fig,'plot','png')
如何将数字完全保存最大化?
答案 0 :(得分:1)
引用文章中提供了大量解决方案。以下解决方案适用于我:
fig = figure('visible','on');
plot(0:0.1:2*pi,sin(0:0.1:2*pi))
grid on
grid minor
set(gca,'FontSize',20,'xtick',0:0.5:2*pi)
pause(0.1)
frame_h = get(handle(gcf),'JavaFrame');
set(frame_h,'Maximized',1);
pause(0.1)
set(fig, 'PaperPositionMode', 'auto');
saveas(fig,'plot','png')
祝你好运