stack

Chart2D.stack(x, ys, colors=None, labels=None)

Add a stack plot to this chart.

Parameters
xarray_like

X coordinates of the points outlining the stacks (areas) to draw.

yslist or tuple of array_like

Size of the stacks (areas) to draw at the corresponding X coordinates. Each sequence defines the sizes of one stack (area), which are stacked on top of each other.

colorslist or tuple of color, optional

Color of the stacks (areas) drawn in this plot. Any color parsable by pyvista.parse_color is allowed. Defaults to None.

labelslist or tuple of str, optional

Label for each stack (area) drawn in this plot, as shown in the chart’s legend. Defaults to [].

Returns
plotting.charts.StackPlot

The created stack plot.

Examples

Generate a stack plot.

>>> import pyvista
>>> chart = pyvista.Chart2D()
>>> plot = chart.stack([0, 1, 2], [[2, 1, 3],[1, 2, 1]])
>>> chart.show()
../../../../_images/pyvista-Chart2D-stack-1_00_00.png