Plotting

Plots and movies

pigreads.plot.imshow_defaults(array=None, sim=None, dx=None, dy=None, Nx=None, Ny=None, **kwargs)

Set default imshow arguments.

Parameters:
  • array (ndarray[Any, Any] | None) – Array to display. (default: None)

  • sim (Simulation | None) – Simulation object. (default: None)

  • dx (float | None) – Grid spacing in x. (default: None)

  • dy (float | None) – Grid spacing in y. (default: None)

  • Nx (int | None) – Number of grid points in x. (default: None)

  • Ny (int | None) – Number of grid points in y. (default: None)

  • kwargs (Any) – Additional arguments.

Return type:

dict[str, Any]

Returns:

Dictionary of arguments for matplotlib.pyplot.imshow().

pigreads.plot.movie(path, frames, dpi=180, fps=15, tlables=None, progress='none', progress_dict=None, parallel=1, **kwargs)

Render a chunk of frames to a movie file, with optional parallelization.

Parameters:
  • path (str) – Path to write the movie file to.

  • frames (ndarray[Any, Any]) – Array of frames.

  • dpi (int) – Dots per inch. (default: 180)

  • fps (int) – Frames per second. (default: 15)

  • tlables (list[str] | None) – List of time labels. (default: None)

  • progress (str) – Progress bar type. (default: 'none')

  • progress_dict (dict[str, int] | None) – Dictionary to store progress. (default: None)

  • parallel (int) – Number of processes (default 1, 0 to use all CPUs). (default: 1)

  • kwargs (Any) – Passed to plot_frame().

Return type:

None

pigreads.plot.plot_frame(ax, frame, xlabel='x', ylabel='y', vlabel='', title='', **kwargs)

Display a frame as an image.

Parameters:
  • ax (Axes) – Axes object.

  • xlabel (str) – Label for the x-axis. (default: 'x')

  • ylabel (str) – Label for the y-axis. (default: 'y')

  • vlabel (str) – Colorbar label. (default: '')

  • title (str) – Title of the plot. (default: '')

  • frame (ndarray[Any, Any]) – Frame to display.

  • kwargs (Any) – Passed to matplotlib.pyplot.imshow().

Return type:

tuple[AxesImage, Colorbar]

Returns:

Image and colorbar objects.