Saving a figure with several subplots on to a file
15 views (last 30 days)
Show older comments
I have a figure that I plot several subplots on. I create this figure associating it with a handle as:
%Create Figure----------------------------------------------------------
sz = [800 1800]; % figure size
screensize = get(groot,'ScreenSize');
xpos = ceil((screensize(3)-sz(2))/2); % center the figure on the
ypos = ceil((screensize(4)-sz(1))/2); % center the figure on the
figHandle=figure('position',[xpos, ypos, sz(2), sz(1)]);
I want to save the complete figure with all subplots to an image file. However using the code below is failing to save anything.
name='results'
name=['c:\',name,'.png']
set(figHandle,'Units','Inches');
pos = get(figHandle,'Position');
set(figHandle,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
print(figHandle,'filename','-dpng','-r0')
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Subplots 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!