Clear Filters
Clear Filters

How to save figure as appears on the screen? with the same aspect ratio, and font size, etc. ?

5 views (last 30 days)
figure('units','normalized','outerposition',[0 0 .5 1]);
hist(rand(100));
saveas(gcf,sprintf('%s.png',mfilename));
For example in this case the output png is not a portrait format, however the figure window is.

Answers (2)

Image Analyst
Image Analyst on 3 Jun 2016

thomas weldon
thomas weldon on 21 Jun 2018
Edited: Walter Roberson on 25 Jun 2018
Try this:
fig=gcf;ax=fig.CurrentAxes;fig.Color='w';fig.OuterPosition=fig.InnerPosition;

Categories

Find more on Introduction to Installation and Licensing 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!