mpl_toolkits.mplot3d.axes3d.Axes3D.bar3d#

Axes3D.bar3d(x, y, z, dx, dy, dz, color=None, zsort='average', shade=True, lightsource=None, *args, axlim_clip=False, data=None, **kwargs)[source]#

Generate a 3D barplot.

This method creates three-dimensional barplot where the width, depth, height, and color of the bars can all be uniquely set.

Parameters:
x, y, zarray-like

The coordinates of the anchor point of the bars.

dx, dy, dzfloat or array-like

The width, depth, and height of the bars, respectively.

colorsequence of colors, optional

The color of the bars can be specified globally or individually. This parameter can be:

  • A single color, to color all bars the same color.

  • An array of colors of length N bars, to color each bar independently.

  • An array of colors of length 6, to color the faces of the bars similarly.

  • An array of colors of length 6 * N bars, to color each face independently.

When coloring the faces of the boxes specifically, this is the order of the coloring:

  1. -Z (bottom of box)

  2. +Z (top of box)

  3. -Y

  4. +Y

  5. -X

  6. +X

zsort{'average', 'min', 'max'}, default: 'average'

The z-axis sorting scheme passed onto Poly3DCollection

shadebool, default: True

When true, this shades the dark sides of the bars (relative to the plot's source of light).

lightsourceLightSource, optional

The lightsource to use when shade is True.

axlim_clipbool, default: False

Whether to hide the bars with points outside the axes view limits.

Added in version 3.10.

dataindexable object, optional

If given, all parameters also accept a string s, which is interpreted as data[s] if s is a key in data.

**kwargs

Any additional keyword arguments are passed onto Poly3DCollection.

Returns:
collectionPoly3DCollection

A collection of three-dimensional polygons representing the bars.