subplotter#
- caf.viz.subplots.subplotter(func, plot_args, nrows, ncols, **subplots_kwargs)[source]#
Plot subplots in a grid, axes plots are created using func.
A roughly square grid of subplots will be created, with a figure size calculated based on the number of subplots in the grid.
- Parameters:
func ((figure.Figure, axes.Axes, ...) -> None) – Function to plot data onto the individual subplot axes, this will be call once with a single axes for each set of arguments in plot_args.
plot_args (list[dict[str, Any]]) – List of arguments for plotting func, the length of this defines the number of subplot axes generated.
nrows (int) – Number of rows of subplots to create.
ncols (int) – Number of columns of subplots to create.
**subplots_kwargs (Keyword arguments) – Any other keyword arguments are passed to plt.subplots. This cannot contain the parameter: ‘squeeze’.
- Returns:
The plotted figure.
- Return type:
figure.Figure
- Raises:
If length of plot_args is 0, or not enough Axes are created to contain all the subplots i.e. ncols * nrows < len(plot_args). - If one of ‘squeeze’ is given in subplots_kwargs.