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 a nata.plots.types.ScatterPlot.

Parameters
  • fig (nata.plots.Figure, optional) – If provided, the plot is drawn on fig. The plot is drawn on axes if it is a child axes of fig, otherwise a new axes is created on fig. If fig is not provided, a new nata.plots.Figure is created.

  • axes (nata.plots.Axes, optional) – If provided, the plot is drawn on axes, which must be an axes of fig. If axes is not provided or is provided without a corresponding fig, a new nata.plots.Axes is created in a new nata.plots.Figure.

  • style (dict, optional) – Dictionary that takes a mix of style properties of nata.plots.Figure, nata.plots.Axes and any plot type (see nata.plots.types.ScatterPlot).

  • interactive (bool, optional) – Controls wether interactive widgets should be shown with the plot to allow for temporal navigation. Only applicable if dataset has multiple iterations.

  • n (int, optional) – Selects the index of the iteration to be shown initially. Only applicable if dataset has multiple iterations, .

Returns

nata.plots.Figure or None – Figure with plot built based on dataset. Interactive widgets are shown with the figure if dataset has multiple iterations, in which case this method returns None.

Examples

To get a plot with default style properties in a new figure, simply call the .plot() method. The first two quantities in the dataset quantities 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()