I want to export a figure but with 50% smaller Width and height
3 views (last 30 days)
Show older comments
Hello all,
I saved my figure using the following code
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]); % Enlarge figure to full screen.
export_fig('F:\Farvardin 99 Codes\Subbasins\precipitation\figures\wintersubbasin1', '-dpng','-transparent', '-r900');
But the generated photo is really big and when I paste it to A4 paper in Microsoft office word I saw a small font size and LineWidth
In addition, I want to have 2 of this figure beside each other in a row; So I want to save it with smaller Width and height, like this:
I want to have the figure still in high quality. Please help me with this issue.
Really thank you
0 Comments
Accepted Answer
Johannes Hougaard
on 20 Apr 2020
Hi Behzad,
I think that rather than using the
set(gcf,'Units','Normalized','OuterPosition', [0, 0.04, 1, 0.96])
you should use the PaperUnits and PaperPosition properties. Keeping the -r900 option will retain the high resolution of the picture.
figure; plot(x,y);
xlabel('x-axis label');
ylabel('y-axis label');
legend('legend1','legend2','legend3','legend4');
set(gcf,'PaperOrientation','landscape');
set(gcf,'PaperUnits','normalized')
set(gcf,'PaperPosition',[0 0 1 1]); % change this to e.g. [0 0 0.5 0.5] or [0 0 0.25 0.5] to get the desired outputs
print(gcf,filename,'-dpng','-r900');
set(gcf,'WindowState','maximize') % if you still wish to maximize your window this is preferred in R2020a
More Answers (0)
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!