pyvista.ChartBox#

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

Dedicated chart for drawing box plots.

Parameters
datalist or tuple of array_like

Dataset(s) from which the relevant statistics will be calculated used to draw the box plot.

colorslist or tuple of color_like, optional

Color used for each drawn boxplot. Defaults to None, which uses the default color scheme.

labelslist or tuple of str, optional

Label for each drawn boxplot, as shown in the chart’s legend. Defaults to [].

Examples

Create boxplots for datasets sampled from shifted normal distributions.

>>> import pyvista
>>> import numpy as np
>>> rng = np.random.default_rng(1)  # Seeded random number generator used for data generation
>>> normal_data = [rng.normal(i, size=50) for i in range(5)]
>>> chart = pyvista.ChartBox(normal_data, labels=[f"x ~ N({i},1)" for i in range(5)])
>>> chart.show()
../../../../_images/pyvista-ChartBox-1_00_00.png

Methods

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

Show this chart in a self contained plotter.

ChartBox.toggle()

Toggle the chart's visibility.

Attributes

ChartBox.background_color

Return or set the chart's background color.

ChartBox.background_texture

Return or set the chart's background texture.

ChartBox.border_color

Return or set the chart's border color.

ChartBox.border_style

Return or set the chart's border style.

ChartBox.border_width

Return or set the chart's border width.

ChartBox.legend_visible

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

ChartBox.loc

Return or set the chart position in normalized coordinates.

ChartBox.plot

Return the BoxPlot instance associated with this chart.

ChartBox.size

Return or set the chart size in normalized coordinates.

ChartBox.title

Return or set the chart's title.

ChartBox.visible

Return or set the chart's visibility.