yt.visualization.base_plot_types module

class yt.visualization.base_plot_types.CallbackWrapper(viewer, window_plot, frb, field, font_properties, font_color)[source]

Bases: object

class yt.visualization.base_plot_types.ImagePlotMPL(fsize=None, axrect=None, caxrect=None, *, norm_handler: NormHandler, colorbar_handler: ColorbarHandler, figure: Figure | None = None, axes: Axes | None = None, cax: Axes | None = None)[source]

Bases: PlotMPL, ABC

A base class for yt plots made using imshow

hide_axes(*, draw_frame=None)[source]

Hide the axes for a plot including ticks and labels

hide_colorbar()[source]

Hide the colorbar for a plot including ticks and labels

save(name, mpl_kwargs=None, canvas=None)

Choose backend and save image to disk

show()
show_axes()[source]

Show the axes for a plot including ticks and labels

show_colorbar()[source]

Show the colorbar for a plot including ticks and labels

class yt.visualization.base_plot_types.PlotMPL(fsize, axrect: tuple[float, float, float, float], *, norm_handler: NormHandler, figure: Figure | None = None, axes: Axes | None = None)[source]

Bases: object

A base class for all yt plots made using matplotlib, that is backend independent.

save(name, mpl_kwargs=None, canvas=None)[source]

Choose backend and save image to disk

show()[source]
yt.visualization.base_plot_types.get_multi_plot(nx, ny, colorbar='vertical', bw=4, dpi=300, cbar_padding=0.4)[source]

Construct a multiple axes plot object, with or without a colorbar, into which multiple plots may be inserted.

This will create a set of matplotlib.axes.Axes, all lined up into a grid, which are then returned to the user and which can be used to plot multiple plots on a single figure.

Parameters:
  • nx (int) – Number of axes to create along the x-direction

  • ny (int) – Number of axes to create along the y-direction

  • colorbar ({'vertical', 'horizontal', None}, optional) – Should Axes objects for colorbars be allocated, and if so, should they correspond to the horizontal or vertical set of axes?

  • bw (number) – The base height/width of an axes object inside the figure, in inches

  • dpi (number) – The dots per inch fed into the Figure instantiation

Returns:

  • fig (matplotlib.figure.Figure) – The figure created inside which the axes reside

  • tr (list of list of matplotlib.axes.Axes objects) – This is a list, where the inner list is along the x-axis and the outer is along the y-axis

  • cbars (list of matplotlib.axes.Axes objects) – Each of these is an axes onto which a colorbar can be placed.

Notes

This is a simple implementation for a common use case. Viewing the source can be instructive, and is encouraged to see how to generate more complicated or more specific sets of multiplots for your own purposes.