clear

Chart2D.clear(plot_type=None)

Remove all plots of the specified type from this chart.

Parameters
plot_typestr, optional

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

Examples

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

>>> import pyvista
>>> chart = pyvista.Chart2D()
>>> _ = chart.plot([0, 1, 2], [2, 1, 3], "o-b")
>>> _ = chart.plot([-2, -1, 0], [3, 1, 2], "d-r")
>>> chart.show()
../../../../_images/pyvista-Chart2D-clear-1_02_00.png

Remove all scatter plots from the chart.

>>> chart.clear("scatter")
>>> chart.show()
../../../../_images/pyvista-Chart2D-clear-1_03_00.png