neuralib.plot.plot.grid_subplots
- neuralib.plot.plot.grid_subplots(data, images_per_row, plot_func, *, dtype, hide_axis=True, sharex=False, sharey=False, title=None, figsize=None, output=None, **kwargs)[source]
Plots a sequence of subplots in a grid format
Example for plot xy grid:
>>> data = np.random.sample((30, 10, 2)) >>> grid_subplots(data, 5, 'plot', dtype='xy')
Example for plot img array grid
>>> data = np.random.sample((30, 10, 10)) >>> grid_subplots(data, 5, 'imshow', dtype='img', cmap='gray')
- Parameters:
data (ndarray | list[ndarray]) – 3D Array containing the data to be plotted. For ‘xy’ dtype, the shape must be (N, (*, 2)). For ‘img’ dtype, the shape must be (N, (*img)). Accepted also list of 2D array different size
images_per_row (int) – Number of images per row in the subplot grid
plot_func (Callable | str) – Function or method name to be used for plotting. If a string is provided, it should be a valid method name of a matplotlib Axes object
dtype (Literal['xy', 'img']) – {‘xy’, ‘img’}. Type of data. ‘xy’ for (x, y) coordinate data, ‘img’ for image data
hide_axis (bool) – If True, hides the axes of the subplots
sharex (bool) – sharex acrross grid plots
sharey (bool) – sharey acrross grid plots
title (list[str] | None) – List of title foreach show in the subplot
figsize (tuple[int, int] | None) – Figure_size pass to
plt.subplots()output (str | Path | PathLike[str] | None) – Path to save the plot image. If None, displays the plot.
kwargs – Additional keyword arguments passed to the plotting function
plot_func
- Returns:
- Return type:
None