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.ParticleDatasetusing anata.plots.types.ScatterPlot.- Parameters
fig (
nata.plots.Figure, optional) – If provided, the plot is drawn onfig. The plot is drawn onaxesif it is a child axes offig, otherwise a new axes is created onfig. Iffigis not provided, a newnata.plots.Figureis created.axes (
nata.plots.Axes, optional) – If provided, the plot is drawn onaxes, which must be an axes offig. Ifaxesis not provided or is provided without a correspondingfig, a newnata.plots.Axesis created in a newnata.plots.Figure.style (
dict, optional) – Dictionary that takes a mix of style properties ofnata.plots.Figure,nata.plots.Axesand 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 ifdatasethas multiple iterations.n (
int, optional) – Selects the index of the iteration to be shown initially. Only applicable ifdatasethas multiple iterations, .
- Returns
nata.plots.FigureorNone– Figure with plot built based ondataset. Interactive widgets are shown with the figure ifdatasethas 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 datasetquantitiesdictionary 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()