arrange_subplots

Version 1.0.0.0 (1.46 KB) by Geng
Automatically computes the #rows and #columns needed to show N subplots.
319 Downloads
Updated 28 Jan 2013

View License

Automatically computes the #rows and #columns needed to show N subplots. This function takes the size of images into consideration.

Can be used to provide inputs for subplot or subplot_tight

function [nrow, ncol] = arrange_subplots(n,imagesz)

Purpose
Calculate how many rows and columns of sub-plots are needed to
neatly display n subplots. This function considers the size of each subplot.

Inputs
n - the desired number of subplots.
imagesz - [height, width] of each subplot. default([1,1])

Outputs
[nrow, ncol] - defining the number of rows and number of columns required to show n plots.

Example: [nrow, ncol] = arrange_subplots(26, [200,500])
[nrow, ncol] = arrange_subplots(26)

Written by Geng Zhang. (www.bfcat.com). Jan. 2013

Cite As

Geng (2024). arrange_subplots (https://www.mathworks.com/matlabcentral/fileexchange/40024-arrange_subplots), MATLAB Central File Exchange. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0