fig_tools¶
Figure layout, axes linking, interactive controls — the plumbing for good-looking multi-panel MATLAB figures.
Part of the Prerau Lab preraulab_utilities meta-repository. Can also be used standalone.
Layout¶
Task |
Use |
|---|---|
Lay out an M × N grid with controlled margins |
|
Open a full-screen figure |
|
Add panel labels (A, B, C, …) |
|
Add a figure-level title/labels across subplots |
|
Merge multiple figures into one |
|
Prep a figure for print / page export |
|
Find the most-square subplot grid for N panels |
|
Axes linking & limits¶
Task |
Use |
|---|---|
Link color axes across a set of axes |
|
Link 3-D camera + xyz limits across axes |
|
Match X/Y limits across axes |
|
Scale color limits to an inner percentile |
|
Set color limits manually |
|
Colorbars & annotations¶
Task |
Use |
|---|---|
Colorbar that doesn’t resize the parent axes |
|
Colorbar along the top |
|
Scale bar on an axis |
|
Shadow / secondary axis |
|
Split an axis into multiple panels |
|
Interaction¶
Task |
Use |
|---|---|
Interactive scroll/zoom/pan with mouse + keyboard |
|
Capture user clicks on a figure |
|
Slice picker UI |
|
Zoom so content fills the axes |
|
Build a stacked-plot control |
|
Example¶
ax = figdesign(2, 3, 'margins', [0.05 0.05 0.05 0.05 0.05]);
for k = 1:6
axes(ax(k));
imagesc(peaks(100) + randn(100));
end
linkcaxes(ax);
climscale(ax, 0.01);
letter_label(ax, 'A', 'TopLeft');
scrollzoompan(ax(1), 'x');
Function list¶
clims, climscale, colorbar_noresize, equalize_axes, figdesign, fullfig, get_clicks, letter_label, linkaxes3d, linkcaxes, mergefigures, outerlabels, outertitle, pagefig, scaleline, scrollzoompan, shadow_axis, slicepopup, split_axis, squarest_subplots, stacked_plot, topcolorbar, zoom_fill
See help <function> at the MATLAB prompt for the full docstring of each.
Install¶
addpath('/path/to/fig_tools');
Dependencies¶
MATLAB R2020a+. No required toolboxes.
License¶
BSD 3-Clause. See LICENSE.