60 views (last 30 days)
Oliver Woodford on 21 Jul 2011
With export_fig you can specify a list of handles of the axes to print, and only these axes will be printed. E.g.:
for a = 1:4
hax(a) = subplot(2,2,a);
export_fig(hax([1 3]), 'test.png');
It essentially implements Daniel's suggestion, so you don't have to. However, it may not work perfectly with GUIs as they tend to behave differently. Try it, though.
More Answers (1)
Daniel Shub on 21 Jul 2011
Printing each subplot/axes as a separate figure is easier than printing a subset of the axes in one figure. Start with a dummy figure making sure you remember the handle to the axis you want to print:
hax = subplot(2,2,2);
Make a new figure, copy the axis to it, scale the axis to be the "full" size, and print it.
hfig = figure;
hax_new = copyobj(hax, hfig);
set(hax_new, 'Position', get(0, 'DefaultAxesPosition'));
You can copy multiple axes in on go, but positioning them nicely in the figure is more difficult.