yt.visualization.profile_plotter.
ProfilePlot
(data_source, x_field, y_fields, weight_field='cell_mass', n_bins=64, accumulation=False, fractional=False, label=None, plot_spec=None, x_log=None, y_log=None)[source]¶Create a 1d profile plot from a data source or from a list of profile objects.
Given a data object (all_data, region, sphere, etc.), an x field, and a y field (or fields), this will create a one-dimensional profile of the average (or total) value of the y field in bins of the x field.
This can be used to create profiles from given fields or to plot multiple profiles created from yt.data_objects.profiles.create_profile.
Parameters: | data_source : YTSelectionContainer Object
x_field : str
y_fields : str or list
weight_field : str
n_bins : int
accumulation : bool
fractional : If True the profile values are divided by the sum of all
label : str or list of strings
plot_spec : dict or list of dicts
x_log : bool
y_log : dict
|
---|
Examples
This creates profiles of a single dataset.
>>> import yt
>>> ds = yt.load("enzo_tiny_cosmology/DD0046/DD0046")
>>> ad = ds.all_data()
>>> plot = ProfilePlot(ad, "density", ["temperature", "velocity_x"],
... weight_field="cell_mass",
... plot_spec=dict(color='red', linestyle="--"))
>>> plot.save()
This creates profiles from a time series object.
>>> es = yt.simulation("AMRCosmology.enzo", "Enzo")
>>> es.get_time_series()
>>> profiles = []
>>> labels = []
>>> plot_specs = []
>>> for ds in es[-4:]:
... ad = ds.all_data()
... profiles.append(create_profile(ad, ["density"],
... fields=["temperature",
... "velocity_x"]))
... labels.append(ds.current_redshift)
... plot_specs.append(dict(linestyle="--", alpha=0.7))
>>>
>>> plot = ProfilePlot.from_profiles(profiles, labels=labels,
... plot_specs=plot_specs)
>>> plot.save()
Use set_line_property to change line properties of one or all profiles.
Attributes
Methods