yt.visualization.profile_plotter.PhasePlot

class yt.visualization.profile_plotter.PhasePlot(data_source, x_field, y_field, z_fields, weight_field='cell_mass', x_bins=128, y_bins=128, accumulation=False, fractional=False, fontsize=18, figure_size=8.0)[source]

Create a 2d profile (phase) plot from a data source or from profile object created with yt.data_objects.profiles.create_profile.

Given a data object (all_data, region, sphere, etc.), an x field, y field, and z field (or fields), this will create a two-dimensional profile of the average (or total) value of the z field in bins of the x and y fields.

Parameters:

data_source : YTSelectionContainer Object

The data object to be profiled, such as all_data, region, or sphere.

x_field : str

The x binning field for the profile.

y_field : str

The y binning field for the profile.

z_fields : str or list

The field or fields to be profiled.

weight_field : str

The weight field for calculating weighted averages. If None, the profile values are the sum of the field values within the bin. Otherwise, the values are a weighted average. Default : “cell_mass”.

x_bins : int

The number of bins in x field for the profile. Default: 128.

y_bins : int

The number of bins in y field for the profile. Default: 128.

accumulation : bool or list of bools

If True, the profile values for a bin n are the cumulative sum of all the values from bin 0 to n. If -True, the sum is reversed so that the value for bin n is the cumulative sum from bin N (total bins) to n. A list of values can be given to control the summation in each dimension independently. Default: False.

fractional : If True the profile values are divided by the sum of all

the profile data such that the profile represents a probability distribution function.

profile : profile object

If not None, a profile object created with yt.data_objects.profiles.create_profile. Default: None.

fontsize: int :

Font size for all text in the plot. Default: 18.

figure_size : int

Size in inches of the image. Default: 8 (8x8)

Examples

>>> import yt
>>> ds = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
>>> ad = ds.all_data()
>>> plot = PhasePlot(ad, "density", "temperature", ["cell_mass"],
...                  weight_field=None)
>>> plot.save()
>>> # Change plot properties.
>>> plot.set_cmap("cell_mass", "jet")
>>> plot.set_zlim("cell_mass", 1e8, 1e13)
>>> plot.set_title("cell_mass", "This is a phase plot")

Attributes

Methods