Plot¶
-
nata.containers.ParticleDataset.
plot
(dataset: nata.containers.ParticleDataset, fig: Optional[nata.plots.figure.Figure] = None, axes: Optional[nata.plots.axes.Axes] = None, style: dict = {}, interactive: bool = True, n: int = 0)¶ Plots a single/multiple iteration
nata.containers.ParticleDataset
using anata.plots.types.ScatterPlot
.- Parameters
fig (
nata.plots.Figure
, optional) – If provided, the plot is drawn onfig
. The plot is drawn onaxes
if it is a child axes offig
, otherwise a new axes is created onfig
. Iffig
is not provided, a newnata.plots.Figure
is created.axes (
nata.plots.Axes
, optional) – If provided, the plot is drawn onaxes
, which must be an axes offig
. Ifaxes
is not provided or is provided without a correspondingfig
, a newnata.plots.Axes
is created in a newnata.plots.Figure
.style (
dict
, optional) – Dictionary that takes a mix of style properties ofnata.plots.Figure
,nata.plots.Axes
and any plot type (seenata.plots.types.ScatterPlot
).interactive (
bool
, optional) – Controls wether interactive widgets should be shown with the plot to allow for temporal navigation. Only applicable ifdataset
has multiple iterations.n (
int
, optional) – Selects the index of the iteration to be shown initially. Only applicable ifdataset
has multiple iterations, .
- Returns
nata.plots.Figure
orNone
– Figure with plot built based ondataset
. Interactive widgets are shown with the figure ifdataset
has multiple iterations, in which case this method returnsNone
.
Examples
To get a plot with default style properties in a new figure, simply call the
.plot()
method. The first two quantities in the datasetquantities
dictionary will be represented in the horizontal and vertical plot axes, respectively. If a third quantity is available, it will be represented in colors.>>> from nata.containers import ParticleDataset >>> import numpy as np >>> arr = np.arange(30).reshape(1,10,3) >>> ds = ParticleDataset("path/to/file") >>> fig = ds.plot()
The list of quantities in the dataset can be filtered with the
nata.containers.ParticleDataset.filter()
method.>>> fig = ds.filter(quantities=["x1", "p1", "ene"]).plot()