grid_plot#

caf.viz.subplots.grid_plot(func, plot_args, **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.

  • **subplots_kwargs (Keyword arguments) – Any other keyword arguments are passed to plt.subplots. This cannot contain the parameters: ‘squeeze’, ‘nrows’ or ‘ncols’.

Returns:

The plotted figure.

Return type:

figure.Figure

Raises:

ValueError

  • If length of plot_args is 0. - If one of ‘squeeze’, ‘nrows’ or ‘ncols’ is given in subplots_kwargs.