Chart2D.bar#
- Chart2D.bar(
- x: VectorLikeFloat,
- y: VectorLikeFloat | MatrixLikeFloat,
- *,
- color: ColorLike | Sequence[ColorLike] | None = None,
- orientation: Literal['H', 'V'] = 'V',
- label: str | Sequence[str] | None = None,
Add a bar plot to this chart.
- Parameters:
- xarray_like
Positions (along the x-axis for a vertical orientation, along the y-axis for a horizontal orientation) of the bars to draw.
- yarray_like
Size of the bars to draw. Multiple bars can be stacked by passing a sequence of sequences.
- color
ColorLike| sequence[ColorLike], optional Color of the bars drawn in this plot, or one color per stacked component. Any color parsable by
pyvista.Coloris allowed. A single component defaults to"b".- orientation
str, default: “V” Orientation of the bars drawn in this plot. Either
"H"for an horizontal orientation or"V"for a vertical orientation.- label
str| sequence[str], optional Label of this plot, or one label per stacked component, as shown in the chart’s legend.
- Returns:
plotting.charts.BarPlotThe created bar plot.
Examples#
Download Python source code | Download Jupyter notebook
Generate a bar plot.
>>> import pyvista as pv
>>> chart = pv.Chart2D()
>>> plot = chart.bar([0, 1, 2], [2, 1, 3])
>>> chart.show()
Used In#
API Examples
BarPlot(1 use)BarPlot.brush(1 use)BarPlot.color(1 use)BarPlot.color_scheme(1 use)BarPlot.colors(1 use)12 more
BarPlot.label(1 use)BarPlot.labels(1 use)BarPlot.line_style(1 use)BarPlot.line_width(1 use)BarPlot.orientation(1 use)BarPlot.pen(1 use)BarPlot.toggle(1 use)BarPlot.update(1 use)BarPlot.visible(1 use)BarPlot.x(1 use)BarPlot.y(1 use)Chart2D(1 use)
Gallery Examples