dabl.plot
.find_pretty_grid¶
- dabl.plot.find_pretty_grid(n_plots, max_cols=5)[source]¶
Determine a good grid shape for subplots.
Tries to find a way to arange n_plots many subplots on a grid in a way that fills as many grid-cells as possible, while keeping the number of rows low and the number of columns below max_cols.
- Parameters:
- n_plotsint
Number of plots to arrange.
- max_colsint, default=5
Maximum number of columns.
- Returns:
- n_rowsint
Number of rows in grid.
- n_colsint
Number of columns in grid.
Examples
>>> find_pretty_grid(16, 5) (4, 4) >>> find_pretty_grid(11, 5) (3, 4) >>> find_pretty_grid(10, 5) (2, 5)