pyvista.plotting.charts.PiePlot

class PiePlot(data, colors=None, labels=None, *, _wrap=None)

Class representing a pie plot.

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

Parameters
dataarray_like

Relative size of each pie segment.

colorslist or tuple of color, optional

Color of the segments 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 pie segment drawn in this plot, as shown in the chart’s legend. Defaults to [].

Other Parameters
_wrapvtk.vtkPlotPie, optional

Wrap an existing VTK PlotPie instance. Defaults to None (no wrapping).

Examples

Create a pie plot showing the usage of tax money.

>>> import pyvista
>>> x = [128.3, 32.9, 31.8, 29.3, 21.2]
>>> l = ["Social benefits", "Governance", "Economic policy", "Education", "Other"]
>>> chart = pyvista.ChartPie(x, labels=l)
>>> chart.show()
../../../../_images/pyvista-plotting-charts-PiePlot-1_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.