pyvista.plotting.charts.AreaPlot

class AreaPlot(x, y1, y2=None, color='b', label='')

Class representing a 2D area plot.

Users should typically not directly create new plot instances, but use the dedicated 2D chart’s plotting methods.

Parameters
xarray_like

X coordinates of the points outlining the area to draw.

y1array_like

Y coordinates of the points on the first outline of the area to draw.

y2array_like, optional

Y coordinates of the points on the second outline of the area to draw. Defaults to a sequence of zeros.

colorcolor, optional

Color of the area drawn in this plot. Any color parsable by pyvista.parse_color is allowed. Defaults to "b".

labelstr, optional

Label of this plot, as shown in the chart’s legend. Defaults to "".

Examples

Create an area plot showing the minimum and maximum precipitation observed in each month.

>>> import pyvista
>>> import numpy as np
>>> x = np.arange(12)
>>> p_min = [11, 0, 16, 2, 23, 18, 25, 17, 9, 12, 14, 21]
>>> p_max = [87, 64, 92, 73, 91, 94, 107, 101, 84, 88, 95, 103]
>>> chart = pyvista.Chart2D()
>>> _ = chart.area(x, p_min, p_max)
>>> chart.x_axis.tick_locations = x
>>> chart.x_axis.tick_labels = ["Jan", "Feb", "Mar", "Apr", "May",
...                             "Jun", "Jul", "Aug", "Sep", "Oct",
...                             "Nov", "Dec"]
>>> chart.x_axis.label = "Month"
>>> chart.y_axis.label = "Precipitation [mm]"
>>> chart.show()
../../../../_images/pyvista-plotting-charts-AreaPlot-1_00_00.png

Methods

AreaPlot.toggle()

Toggle the plot's visibility.

AreaPlot.update(x, y1[, y2])

Update this plot's points, outlining the area to draw.

Attributes

AreaPlot.brush

Brush object controlling how shapes in this plot are filled.

AreaPlot.color

Return or set the plot's color.

AreaPlot.label

Return or set the this plot's label, as shown in the chart's legend.

AreaPlot.line_style

Return or set the line style of all lines drawn in this plot.

AreaPlot.line_width

Return or set the line width of all lines drawn in this plot.

AreaPlot.pen

Pen object controlling how lines in this plot are drawn.

AreaPlot.visible

Return or set the this plot's visibility.

AreaPlot.x

Retrieve the X coordinates of the points outlining the drawn area.

AreaPlot.y1

Retrieve the Y coordinates of the points on the first outline of the drawn area.

AreaPlot.y2

Retrieve the Y coordinates of the points on the second outline of the drawn area.