yt.visualization.base_plot_types module

This is a place for base classes of the various plot types.

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, axrect, caxrect, zlim, figure, axes, cax)[source]

Bases: yt.visualization.base_plot_types.PlotMPL

A base class for yt plots made using imshow

hide_axes()[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, figure, axes)[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.