
Panel 2
Overview
At its simplest, Panel is a Matlab utility that simplifies the layout of multi-axis figures, for which you might otherwise use subplot(). An example layout is shown in the illustration (click to enlarge).
Resources
- These HTML pages provide a brief introduction to Panel. This page gives an overview of features, Layout covers how panel governs layout within a figure, and Export briefly describes the additional concerns when exporting to image files. And, of course, there's the FAQ.
- The more complete User Guide for Panel comprises a collection of demo scripts; use help panel/demo at the prompt to see a list of the demos, and then use edit demopanel1 to get started looking at the code.
- Detailed reference information is available through Matlab's documentation system (doc panel) or at the prompt (help panel, help panel/panel).
If you are new to Panel, start with demopanel1, and work your way through until you grow bored. If you want to know how to do something in particular, try help panel/demo and look through the headings.
Features
- Simple control over layout, for rapid development of complex nested layouts - see example top right, thirty seconds work (see demopanel1).
- Easy rearrangement of layout, as opposed to sometimes tricksy subplot renumbering operation.
- Figure-wide control of rendering (font size, face, etc.).
- Work in physical units (millimetres, inches, etc.) or relative sizes, where appropriate.
- An important feature is WYSIWYG rendering to image files. Coupled with the easy control over layout, this facilitates the generation of camera-ready artwork direct from Matlab.
- Labelling/Titling of subplot groups, rather than individual subplots.
- Interaction with other graphics objects (e.g. uipanels), not just axes.
Changes since Panel 1
Upgrading users of Panel 1 will notice the following changes.- Moved to a classdef single-file implementation. The modern world, eh...
- Neater, but different, interface, mainly as a result of the above change.
- In Panel 1 you told Panel how to achieve the layout you want (rootmargin, axismargin, parentmargin). In Panel 2, you tell Panel what to aim for (one margin setting only, per panel) and it figures out for itself how to do it.
- Support for being a child and parent of other graphics objects (rather than just Figures and Axes).
- Miscellaneous feature additions (support for resize callbacks, layout reveal information, axis group labelling/titling, and some slight improvements to the export facility).
- Integrated various suggestions from Matlab Central users.
- One feature has not been integrated into Panel 2 - that's engineering scales. This will probably not be implemented since it's not about layout; alternative solutions can be found on Matlab Central.
Changes since Panel 2.9
Upgrading users of Panel 2.9 (to 2.10) will notice the following changes.- Support is added for panels of fixed physical size (i.e. millimeters or inches). This required a change to the interface at panel.pack(). The legacy interface is still supported, but the documentation has been changed to promote the new interface to new users. Using the new interface is recommended in new code, but there are no plans to withdraw the legacy interface in a future update.
Gotchas
- Matlab's hold off operation messes up panel's control over font properties. If you have to use hold off, see help panel/hold to see the options for working around this.
Acknowledgements
Several Matlab Central users have made helpful suggestions which have led to Panel being improved. These are Arthur Ward, Niko, LP Pakula, Ian, Daniel, Mukhtar Ullah, Brendan Sullivan, Ann Hickox, and Elliot. Export to SVG (Scalable Vector Graphics) requires plot2svg() by Juerg Schwizer (this does not ship with Panel, but is free to download here).