pyvista.plotting.charts.PiePlot

Contents

pyvista.plotting.charts.PiePlot#

class PiePlot(chart, data, colors=None, labels=None, *, _wrap=None)[source]#

Class representing a pie plot.

Users should typically not directly create new plot instances, but use the dedicated ChartPie class.

Parameters:
chartChartPie

The chart containing this plot.

dataarray_like

Relative size of each pie segment.

colorssequence[ColorLike], optional

Color of the segments drawn in this plot. Any color parsable by pyvista.Color is allowed. If omitted (None), the default color scheme is used.

labelssequence[str], default: []

Label for each pie segment drawn in this plot, as shown in the chart’s legend.

Examples

Create a pie plot showing the usage of tax money.

>>> import pyvista as pv
>>> x = [128.3, 32.9, 31.8, 29.3, 21.2]
>>> l = [
...     'Social benefits',
...     'Governance',
...     'Economic policy',
...     'Education',
...     'Other',
... ]
>>> chart = pv.ChartPie(x, labels=l)
>>> chart.show()
../../../../_images/pyvista-plotting-charts-PiePlot-2_00_00.png

Methods

PiePlot.toggle()

Toggle the plot's visibility.

PiePlot.update(data)

Update the size of the pie segments.

Attributes

PiePlot.brush

Brush object controlling how shapes in this plot are filled.

PiePlot.color

Return or set the plot's color.

PiePlot.color_scheme

Return or set the plot's color scheme.

PiePlot.colors

Return or set the plot's colors.

PiePlot.data

Retrieve the sizes of the drawn segments.

PiePlot.label

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

PiePlot.labels

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

PiePlot.line_style

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

PiePlot.line_width

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

PiePlot.pen

Pen object controlling how lines in this plot are drawn.

PiePlot.visible

Return or set the this plot's visibility.