yt.raven.PlotCollection.add_projection

PlotCollection.add_projection(field, axis, weight_field=None, data_source=None, center=None, use_colorbar=True, figure=None, axes=None, fig_size=None, periodic=True, obj=None, field_parameters=None)

Create a projection, from that a projection plot, and add it to the current collection.

This function will generate a yt.lagos.AMRProjBase from the given parameters. This projection then gets passed to a yt.raven.ProjectionPlot, and the resultant plot is added to the current collection. Various parameters allow control of the way the slice is displayed, as well as how the slice is generated.

Parameters :

field : string

The initial field to slice and display.

axis : int

The axis along which to slice. Can be 0, 1, or 2 for x, y, z.

data_source : yt.lagos.AMRData

This is a data source respecting the AMRData protocol (i.e., it has grids and so forth) that will be used as input to the projection.

weight_field : string

If specified, this will be the weighting field and the resultant projection will be a line-of-sight average, defined as sum( f_i * w_i * dl ) / sum( w_i * dl )

center : array_like, optional

The center to be used for things like radius and radial velocity. Defaults to the center of the plot collection.

use_colorbar : bool, optional

Whether we should leave room for and create a colorbar.

figure : matplotlib.figure.Figure, optional

The figure onto which the axes will be placed. Typically not used unless axes is also specified.

axes : matplotlib.axes.Axes, optional

The axes object which will be used to create the image plot. Typically used for things like multiplots and the like.

fig_size : tuple of floats

This parameter can act as a proxy for the manual creation of a figure. By specifying it, you can create plots with an arbitrarily large or small size. It is in inches, defaulting to 100 dpi.

periodic : boolean, optional

By default, the slices are assumed to be periodic, and they will wrap around the edges.

obj : yt.lagos.AMRProjBase, optional

If you would like to use an existing projection, you may specify it here, in which case a new projection will not be created. If this option is specified the options data_source, weight_field and field_parameters will be ignored.

field_parameters : dict, optional

This set of parameters will be passed to the slice upon creation, which can be used for passing variables to derived fields.

Returns :

plot : yt.raven.ProjectionPlot

The plot that has been added to the PlotCollection.

See also

yt.lagos.AMRProjBase
This is the type created by this function and passed to the plot created here.

Notes

This is the primary mechanism for creating projection plots, and generating projection plots along multiple axes was the original purpose of the PlotCollection.

Note that all plots can be modified. See callback_list for more information.

Examples

>>> pf = load("RD0005-mine/RedshiftOutput0005")
>>> pc = PlotCollection(pf, [0.5, 0.5, 0.5])
>>> p = pc.add_projection("Density", 0, "Density")

Previous topic

yt.raven.PlotCollection.add_profile_sphere

Next topic

yt.raven.PlotCollection.add_ray

This Page