
Panel 2
Overview
Panel 2 is a Matlab utility that simplifies laying out multi-panel figures, for which you might otherwise use subplot(). Click on the figure thumbnail to the right to see an example layout.
Resources
- This file is a brief introduction to Panel. This accompanying file is a brief introduction to how Panel manages layout.
- The User Guide for Panel consists of a collection of demo scripts; use help panel/demo at the prompt, or just edit demopanel1 to get started.
- Detailed reference information is available through Matlab's documentation system (doc panel) or at the prompt (help 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 allows the generation of camera-ready artwork direct from Matlab.
- Labelling/Titling of subplot groups, rather than individual subplots.
- Interation 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 how you want it to look (margin only, per axis) and it achieves that for you.
- 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 yet been integrated into Panel 2 - that's engineering scales. This will probably turn up in a later version; it's not a core part of Panel in any case. Let me know if you miss it.
Gotchas
- Matlab's hold() function messes up panel's control over font properties. If you are having trouble, use panel's hold() function instead, which works in just the same way (see doc panel). Or you can just call refresh() when you're done messing around with your panels.
- Panel solves a Linear Programming (LP) problem to maximise use of space. If you have the Mathworks Optimisation Toolbox installed, linprog() is used, which is very fast. If you do not, Panel uses its own internal solver, which is not optimised for large problems and so it can be noticeably slow for complex layouts. If you are having trouble with this, let me know and I will prioritise incorporating an optimised solver.
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 and Mukhtar Ullah. The incorporated LP solver is due to Jeff Stuart, formerly of USM.