yt.visualization.plot_window.OffAxisProjectionPlot

class yt.visualization.plot_window.OffAxisProjectionPlot(ds, normal, fields, center='c', width=None, depth=(1, '1'), axes_unit=None, weight_field=None, max_level=None, north_vector=None, volume=None, no_ghost=False, le=None, re=None, interpolated=False, fontsize=18, method='integrate')[source]

Creates an off axis projection plot from a dataset

Given a ds object, a normal vector to project along, and a field name string, this will return a PWViewerMPL object containing the plot.

The plot can be updated using one of the many helper functions defined in PlotWindow.

Parameters:

ds : yt.data_objects.api.Dataset

This is the dataset object corresponding to the simulation output to be plotted.

normal : a sequence of floats

The vector normal to the slicing plane.

fields : string

The name of the field(s) to be plotted.

center : A sequence of floats, a string, or a tuple.

The coordinate of the center of the image. If set to ‘c’, ‘center’ or left blank, the plot is centered on the middle of the domain. If set to ‘max’ or ‘m’, the center will be located at the maximum of the (‘gas’, ‘density’) field. Centering on the max or min of a specific field is supported by providing a tuple such as (“min”,”temperature”) or (“max”,”dark_matter_density”). Units can be specified by passing in center as a tuple containing a coordinate and string unit name or by passing in a YTArray. If a list or unitless array is supplied, code units are assumed.

width : tuple or a float.

Width can have four different formats to support windows with variable x and y widths. They are:

format example
(float, string) (10,’kpc’)
((float, string), (float, string)) ((10,’kpc’),(15,’kpc’))
float 0.2
(float, float) (0.2, 0.3)

For example, (10, ‘kpc’) requests a plot window that is 10 kiloparsecs wide in the x and y directions, ((10,’kpc’),(15,’kpc’)) requests a window that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along the y axis. In the other two examples, code units are assumed, for example (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3 in code units. If units are provided the resulting plot axis labels will use the supplied units.

depth : A tuple or a float

A tuple containing the depth to project through and the string key of the unit: (width, ‘unit’). If set to a float, code units are assumed

weight_field : string

The name of the weighting field. Set to None for no weight.

max_level: int :

The maximum level to project to.

axes_unit : A string

The name of the unit for the tick labels on the x and y axes. Defaults to None, which automatically picks an appropriate unit. If axes_unit is ‘1’, ‘u’, or ‘unitary’, it will not display the units, and only show the axes name.

north-vector : a sequence of floats

A vector defining the ‘up’ direction in the plot. This option sets the orientation of the slicing plane. If not set, an arbitrary grid-aligned north-vector is chosen.

fontsize : integer

The size of the fonts for the axis, colorbar, and tick labels.

method : string

The method of projection. Valid methods are:

“integrate” with no weight_field specified : integrate the requested field along the line of sight.

“integrate” with a weight_field specified : weight the requested field by the weighting field and integrate along the line of sight.

“sum” : This method is the same as integrate, except that it does not multiply by a path length when performing the integration, and is just a straight summation of the field along the given axis. WARNING: This should only be used for uniform resolution grid datasets, as other datasets may result in unphysical images.

Methods