I have this code:
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')
When the plot is saved, it is not maximized and hence the tick numbers cram into each other. I used the solution from this question, but it did not work:
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')
How can I save the figure fully maximized?