pyvista.Chart2D.plot

Contents

pyvista.Chart2D.plot#

Chart2D.plot(x, y=None, fmt='-')[source]#

Matplotlib like plot method.

Parameters:
xarray_like

Values to plot on the X-axis. In case y is None, these are the values to plot on the Y-axis instead.

yarray_like, optional

Values to plot on the Y-axis.

fmtstr, default: “-”

A format string, e.g. 'ro' for red circles. See the Notes section for a full description of the format strings.

Returns:
scatter_plotplotting.charts.ScatterPlot2D, optional

The created scatter plot when a valid marker style was present in the format string, None otherwise.

line_plotplotting.charts.LinePlot2D, optional

The created line plot when a valid line style was present in the format string, None otherwise.

Notes

This plot method shares many of the same plotting features as the matplotlib.pyplot.plot. Please reference the documentation there for a full description of the allowable format strings.

Examples

Generate a line plot.

>>> import pyvista as pv
>>> chart = pv.Chart2D()
>>> _, line_plot = chart.plot(range(10), range(10))
>>> chart.show()
../../../../_images/pyvista-Chart2D-plot-2_01_00.png

Generate a line and scatter plot.

>>> chart = pv.Chart2D()
>>> scatter_plot, line_plot = chart.plot(range(10), fmt='o-')
>>> chart.show()
../../../../_images/pyvista-Chart2D-plot-2_03_00.png