JISUBPLOT + NEXTPLOT: enhanced replacement for subplot
다운로드 수: 1.6K
업데이트 날짜: 2006/8/31
OVERVIEW: Enhanced replacement for SUBPLOT
Multi-axis plotting (using SUBPLOT) is great and essential, but has
shortcomings. The main one is that keeping track of the axis indexes
can be tedious if you want to do anything more elaborate than plotting
in row-order. In addition, the size of all axes are the same, and
spacing is not adjustable.
Solution: JISUBPLOT + NEXTPLOT
What you might really want is to set up a grid of subplots once and
then just tell the figure when you want to move to the next plot,
letting it take care of the details for you.
That's what the pair of functions JISUBPLOT and NEXTPLOT can do.
It decouples the specification of the subplot grid (JISUBPLOT) from the
act of moving around it and creating new axes at various positions
(and sizes) within the grid (NEXTPLOT).
The key that differentiates this solution is NEXTPLOT. Using it,
you can create new axes, automatically move by row, or by column,
or arbitrarily. You can create subplots of mixed sizes. You don' t
need to concern yourself with subplot indexes or coordinates
and can concentrate on how you want the layout to appear.
NEXTPLOT is especially useful in loops where you want create an array of many plots:
for idx = 1:8,
Finally, wouldn't it be nice if when you changed a figure's orientation (e.g. orient tall), it actually changed shape to reflect that? JISUBPLOT does that.
%% the basic idea
jisubplot(4,2,1) % can be used just like SUBPLOT
nextplot % advance to next axis
nextplot('newRow') % start a new row of axes
nextplot('byCol') % move down columns
%% jisubplot / nextplot is especially useful in loops
%% it will extend to new figures automatically
jisubplot(4,4,0) %setup figure, but don't make the first axis
for idx = 1:32,
%% a more complete usage: specify orientation, plot spacing and fontsize
%% figure window is sized appropriately for orientation
Run JISUBPLOTDEMO for executable examples of more advanced usage.
jisubplot.m -- setup figure for automated multi-pane layout
nextplot.m -- automatically advance to next pane
currentplotis.m -- test location of current axis
jisubplotdemo.m -- demonstration of usage
And the following general utility files (used by nextplot)
These are used for parameter/value argument parsing,
and may be generally of use.
isparam.m -- test for presence of a parameter
getparam.m -- get values following a parameter
strmatch_mixed.m -- strmatch that can be used on cell arrays with non-string elements
useful when parsing parameter/value lists
John Iversen (2023). JISUBPLOT + NEXTPLOT: enhanced replacement for subplot (https://www.mathworks.com/matlabcentral/fileexchange/12103-jisubplot-nextplot-enhanced-replacement-for-subplot), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
플랫폼 호환성Windows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!