Primary Plot Interface

Plot Collection

PlotCollection is the basic means by which most of your backend-plotting will take place, and it contains a number of convenience functions for generating images and manipulating existing plots.

class yt.raven.PlotCollection(pf, deliverator_id=-1, center=None)

Generate a collection of linked plots using pf as a source, optionally submitting to the deliverator with deliverator_id and with center, which will otherwise be taken to be the point of maximum density.

add_cutting_plane(field, normal, center=None, use_colorbar=True, figure=None, axes=None, fig_size=None, obj=None)
Generate a cutting plane of field with normal, centered at center (defaults to PlotCollection center) with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches). If so desired, obj is a pre-existing cutting plane object.
add_phase_object(data_source, fields, cmap=None, weight='CellMassMsun', accumulation=False, x_bins=64, x_log=True, x_bounds=None, y_bins=64, y_log=True, y_bounds=None, lazy_reader=False, id=None, axes=None, figure=None)
Given a data_source, and fields, automatically generate a 2D profile and plot it. id is used internally to add onto the prefix, and will be automatically generated if not given. Remainder of arguments are identical to add_profile_object().
add_phase_sphere(radius, unit, fields, **kwargs)
Given a radius and unit, generate a 2D profile from a sphere, with fields as the x,y,z. Automatically weights z by CellMassMsun. kwargs get passed onto add_phase_object().
add_profile_object(data_source, fields, weight='CellMassMsun', accumulation=False, x_bins=64, x_log=True, x_bounds=None, lazy_reader=False, id=None, axes=None, figure=None)
Use an existing data object, data_source, to be the source of a one-dimensional profile. fields will define the x and y bin-by fields, weight is used to weight the y value, accumulation determines if y is summed along x, x_bins, x_log and x_bounds define the means of choosing the bins. id is used internally to differentiate between multiple plots in a single collection. lazy_reader determines the memory-conservative status.
add_profile_sphere(radius, unit, fields, **kwargs)
Generate a spherical 1D profile, given only a radius, a unit, and at least two fields. Any remaining kwargs will be passed onto add_profile_object().
add_projection(field, axis, weight_field=None, center=None, use_colorbar=True, figure=None, axes=None, fig_size=None)
Generate a projection of field along axis, optionally giving a weight_field-weighted average with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)
add_slice(field, axis, coord=None, center=None, use_colorbar=True, figure=None, axes=None, fig_size=None)
Generate a slice through field along axis, optionally at [axis]=*coord*, with the center attribute given (some degeneracy with coord, but not complete), with use_colorbar specifying whether the plot is naked or not and optionally providing pre-existing Matplotlib figure and axes objects. fig_size in (height_inches, width_inches)
autoscale()
Turn back on autoscaling.
clear_plots()
Delete all plots and their attendant data.
save(basename, format='png', override=False)
Same plots with automatically generated names, prefixed with basename (including directory path) unless override is specified, and in format.
set_cmap(cmap)
Change the colormap of all plots to cmap.
set_lim(lim)
Shorthand for setting x,y at same time. lim should be formatted as (xmin,xmax,ymin,ymax)
set_width(width, unit)
Set the witdh of the slices, cutting planes and projections to be width units
set_xlim(xmin, xmax)
Set the x boundaries of all plots.
set_ylim(ymin, ymax)
Set the y boundaries of all plots.
set_zlim(zmin, zmax)
Set the limits of the colorbar.
switch_field(field)
Change all the fields displayed to be field
switch_z(field)
Change all the fields displayed to be field

Plot Modification Callbacks

These are all meant to be instantiated and fed into yt.raven.RavenPlot.add_callback().

class yt.raven.PlotCallback(*args, **kwargs)
class yt.raven.QuiverCallback(field_x, field_y, factor)
Adds a ‘quiver’ plot to any plot, using the field_x and field_y from the associated data, skipping every factor datapoints.
class yt.raven.ParticleCallback(axis, width, p_size=1.0, col='k')
Adds particle positions, based on a thick slab along axis with a width along the line of sight. p_size controls the number of pixels per particle, and col governs the color.
class yt.raven.ContourCallback(field, ncont=5, factor=4, take_log=False, clim=None, plot_args=None)
Add contours in field to the plot. ncont governs the number of contours generated, factor governs the number of points used in the interpolation, take_log governs how it is contoured and clim gives the (upper, lower) limits for contouring.
class yt.raven.GridBoundaryCallback(alpha=1.0, min_pix=1)
Adds grid boundaries to a plot, optionally with alpha-blending. Cuttoff for display is at min_pix wide.
class yt.raven.UnitBoundaryCallback(unit='au', factor=4, text_annotate=True, text_which=-2)
Add on a plot indicating where factor*s of *unit are shown. Optionally text_annotate on the text_which-indexed box on display.
class yt.raven.LinePlotCallback(x, y, plot_args=None)
Over plot x and y with plot_args fed into the plot.
class yt.raven.CuttingQuiverCallback(field_x, field_y, factor)
Get a quiver plot on top of a cutting plane, using field_x and field_y, skipping every factor datapoint in the discretization.