21 May 2008
02 Apr 2015)
Like subplot, but easier, and WYSIWYG export to file. Also fixes dashed/dotted lines in export.
% Basic use. Panel is just like subplot.
% (a) Create a grid of panels.
% (b) Plot into each sub-panel.
% create a NxN grid in gcf (this will create a figure, if
% none is open).
% you can pass the figure handle to the constructor if you
% need to attach the panel to a particular figure, as:
% p = panel(h_figure)
% NB: you can use this code to compare using panel() with
% using subplot(). you should find they do much the same
% thing in this case, but with a slightly different layout.
N = 2;
use_panel = 1;
p = panel();
% plot into each panel in turn
for m = 1:N
for n = 1:N
% select one of the NxN grid of sub-panels
subplot(N, N, m + (n-1) * N);
% plot some data
% you can use all the usual calls
% and so on - generally, you can treat the axis panel
% like any other axis
axis([0 100 -3 3]);