Layout subplots

layout_subplots.m creates subplots with well-defined sizes and positions in a figure. It can be useful for creating publication quality figures.

Note on sizing

layout_subplots() creates figures with a default width of 3.5 inches. The images in this documentation will be resized by the browser and will likely appear at a different width. You can adjust the width of the figure with the figure_width option - see examples.

Single panel with default padding

layout_subplots();

Change figure width

layout_subplots( ...
    figure_width = 6);

Two panels across

layout_subplots( ...
    panels_wide = 2);

Change horizontal padding

layout_subplots( ...
    panels_wide = 2, ...
    padding_left = 0.3, ...
    padding_right = 0.6);

Multiple rows

layout_subplots( ...
    panels_wide = 2, ...
    panels_high = 2);

Change vertical padding

layout_subplots( ...
    panels_wide = 2, ...
    panels_high = 2, ...
    padding_top = 0.5, ...
    padding_bottom = 0.1);

Different padding for different columns

layout_subplots( ...
    panels_wide = 2, ...
    panels_high = 2, ...
    padding_left = [1 0.2]);

Different padding for different rows

layout_subplots( ...
    panels_wide = 2, ...
    panels_high = 2, ...
    padding_top = [1 0.2]);

Omit panels

layout_subplots( ...
    panels_wide = 2, ...
    panels_high = 2, ...
    omit_subplots = [2 3]);

Padding craziness

layout_subplots( ...
    panels_wide = 2, ...
    panels_high = 3, ...
    padding_left = [1 0.5 0.1 0.1 0.5 1]);

Change aspect ratio

layout_subplots( ...
    panels_wide = 2, ...
    panels_high = 3, ...
    x_to_y_ratio = 3);