plots

Chart2D.plots(plot_type=None)

Return all plots of the specified type in this chart.

Parameters
plot_typestr, optional

The type of plots to return. Allowed types are "scatter", "line", "area", "bar" and "stack". Defaults to None, which will return all plots, regardless of their type.

Yields
plotplotting.charts.ScatterPlot2D, plotting.charts.LinePlot2D, plotting.charts.AreaPlot, plotting.charts.BarPlot or plotting.charts.StackPlot

One of the plots (of the specified type) in this chart.

Examples

Create a 2D chart with a line and scatter plot.

>>> import pyvista
>>> chart = pyvista.Chart2D()
>>> scatter_plot, line_plot = chart.plot([0, 1, 2], [2, 1, 3], "o-")
>>> chart.show()
../../../../_images/pyvista-Chart2D-plots-1_01_00.png

Retrieve all plots in the chart.

>>> plots = [*chart.plots()]
>>> scatter_plot in plots and line_plot in plots
True

Retrieve all line plots in the chart.

>>> line_plots = [*chart.plots("line")]
>>> line_plot == line_plots[0]
True