stack#
- Chart2D.stack(x, ys, colors=None, labels=None)[source]#
Add a stack plot to this chart.
- Parameters:
- xarray_like
X coordinates of the points outlining the stacks (areas) to draw.
- ys
list
ortuple
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.
- colors
list
ortuple
of
ColorLike
,optional
Color of the stacks (areas) drawn in this plot. Any color parsable by
pyvista.Color
is allowed.- labels
list
ortuple
of
str
, default: [] Label for each stack (area) drawn in this plot, as shown in the chart’s legend.
- 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()