Skip to content

utils

py3dinterpolations.plotting.utils

Plotting utilities.

number_of_plots(n, n_cols=4)

Determine grid layout rows and columns for n subplots.

Source code in py3dinterpolations/plotting/utils.py
10
11
12
13
def number_of_plots(n: int, n_cols: int = 4) -> tuple[int, int]:
    """Determine grid layout rows and columns for n subplots."""
    n_rows = (n + n_cols - 1) // n_cols
    return n_rows, n_cols