subplot_grid

A subplot figure with a lot of fancy features

1.8K Downloads

Updated Mon, 12 Jan 2015 10:04:43 +0000

View License

SUBPLOT_GRID is a class with which a set of subplots can be created in a space-optimal way. In addition, a figure title and subtitle may be added, as well as specific row and column titles.
Even after resizing, the texts ((sub)figure title and row and column titles) are NOT scaled, keeping the maximum space for the axes.
The SUBPLOTZOOM (combined with maybe ZOOMLINK_AXES) function enables filling the figure window with one or more axes.
The INTERAXES function provides the possibility to show the clicked on data point in an axes, and to shows its values in the title.
The methods LEGEND and COLORBAR ensure a correct handling on zooming and resizing.
Saving the figure to a .fig file, and reloading it via 'openfig' will give a working and fully functionning subplot_grid again. To enable access to the properties and functions/methods, an object called 'o_subplot_grid' is created in the workspace. Within this object all wanted properties and methods can be called.
Available methods (listed alphabetically):

COLORBAR - creates a colorbar to an axes
COLTITLES - Adds column titles (top and bottom are possible, locations can be manually set)
FIGTITLE - Adds a figure title
SUBFIGTITLE - Adds a subtitle
DISABLE_INTERAXES - remove clickable content
DISABLE_SUBPLOTZOOM - remove zoom action
ENABLE_INTERAXES - Enable clickable content
ENABLE_SUBPLOTZOOM - Enable figure filling zoom
EXTRACT_AXES- extract an axes to a new figure
FIGPLACE - grid the figure window or maximize the window
FIGTITLE - add a global figure title
HIDE_AXES - make some axes invisible
HIDE_EMPTY_AXES - hide all empty axes
LEGEND - add a pre-defined legend
OVERWRITE_INTERAXES_SELECTION_MODS - some user-defined modifications for clickable content (interaxes)
REDRAW - redraw the figure (re-align all)
REMOVE_LEGEND - remove legend
ROWTITLES- add texts on the left/right around the axes. Location can be manually set
SET_GCA - set axes to current axes in matlab
SET_PADDING - reset padding around axes
SHOW_AXES - show hidden axes
SUBFIGTITLE - a subtitle
SYNC_AXES - sync x, y or color axes
ZOOMLINK_AXES - link axes on use of subplotzoom.

run 'subplot_grid' for a demo.

The syntax of every method can be found by 'help subplot_grid.<method>'

Cite As

Joris Kampman (2023). subplot_grid (https://www.mathworks.com/matlabcentral/fileexchange/34191-subplot_grid), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: subtightplot

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.11.0.0

This version is suitable for R2014b, without any guarantee or expected performance for lower matlab releases (i.e., it is checked for hgVersion 2, and hgVersion 1 is not supported!).

Saving the figure is now possible, and the colorbar is upgraded

1.10.0.0

fixed minor irritation. Now, after construction of a subplot_grid object, the current axes is set to the first subplot, instead of being left undefined

1.9.0.0

1. possibility to save a .fig file and load without errors
2. very flexible row and column titles on all 4 sides.
3. different resizing scheme (more robust)
4. minor bugfixes

1.8.0.0

very stupid bug fixed (seen when only plotting a single axes (subplot_grid(1) crashed)

1.7.0.0

see 'help subplot_grid'

1.6.0.0

-Bugfixes
-speed improvement (thanks to Dan Kominsky)
-added method COLORBAR
-added possibility to link axes on zooming in

1.5.0.0

1: Matched the legend style to MATLAB
2: Bugfix in the legend placement
3: Added correct handling of axes deletion.
4: Added COLORBAR method.
5: Added SET_PADDING which allows control over the amount of whitespace between axes

1.2.0.0

some bugfixes on legend placements, and the correct working with zooming in and out.

1.0.0.0