pyvista.ChartPie#

class ChartPie(data, colors=None, labels=None)[source]#

Dedicated chart for drawing pie plots.

Parameters
dataarray_like

Relative size of each pie segment.

colorslist or tuple of color_like, optional

Color used for each pie segment drawn in this plot. Defaults to None, which uses the default color scheme.

labelslist or tuple of str, optional

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

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-ChartPie-1_00_00.png

Methods

ChartPie.show([off_screen, full_screen, ...])

Show this chart in a self contained plotter.

ChartPie.toggle()

Toggle the chart's visibility.

Attributes

ChartPie.background_color

Return or set the chart's background color.

ChartPie.background_texture

Return or set the chart's background texture.

ChartPie.border_color

Return or set the chart's border color.

ChartPie.border_style

Return or set the chart's border style.

ChartPie.border_width

Return or set the chart's border width.

ChartPie.legend_visible

Return or set the visibility of the chart's legend.

ChartPie.loc

Return or set the chart position in normalized coordinates.

ChartPie.plot

Return the PiePlot instance associated with this chart.

ChartPie.size

Return or set the chart size in normalized coordinates.

ChartPie.title

Return or set the chart's title.

ChartPie.visible

Return or set the chart's visibility.