mpl_toolkits.mplot3d.axes3d.Axes3D.voxels#

Axes3D.voxels([x,y,z,]/,filled,facecolors=None,edgecolors=None,**kwargs)[source]#

Plot a set of filled voxels

All voxels are plotted as 1x1x1 cubes on the axis, withfilled[0,0,0] placed with its lower corner at the origin.Occluded faces are not plotted.

Parameters:
filled3D np.array of bool

A 3D array of values, with truthy values indicating which voxelsto fill

x, y, z3D np.array, optional

The coordinates of the corners of the voxels. This should broadcastto a shape one larger in every dimension than the shape offilled. These can be used to plot non-cubic voxels.

If not specified, defaults to increasing integers along each axis,like those returned byindices().As indicated by the/ in the function signature, thesearguments can only be passed positionally.

facecolors, edgecolorsarray-like, optional

The color to draw the faces and edges of the voxels. Can only bepassed as keyword arguments.These parameters can be:

  • A single color value, to color all voxels the same color. Thiscan be either a string, or a 1D RGB/RGBA array

  • None, the default, to use a single color for the faces, andthe style default for the edges.

  • A 3Dndarray of color names, with each item the colorfor the corresponding voxel. The size must match the voxels.

  • A 4Dndarray of RGB/RGBA data, with the componentsalong the last axis.

shadebool, default: True

Whether to shade the facecolors.

lightsourceLightSource, optional

The lightsource to use whenshade is True.

axlim_clipbool, default: False

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

Added in version 3.10.

**kwargs

Additional keyword arguments to pass ontoPoly3DCollection.

Returns:
facesdict

A dictionary indexed by coordinate, wherefaces[i,j,k] is aPoly3DCollection of the faces drawn for the voxelfilled[i,j,k]. If no faces were drawn for a given voxel,either because it was not asked to be drawn, or it is fullyoccluded, then(i,j,k)notinfaces.

Examples

(Sourcecode,2x.png,png)

(Sourcecode,2x.png,png)

(Sourcecode,2x.png,png)

(Sourcecode,2x.png,png)

Examples usingmpl_toolkits.mplot3d.axes3d.Axes3D.voxels#

3D voxel / volumetric plot

3D voxel / volumetric plot

3D voxel plot of the NumPy logo

3D voxel plot of the NumPy logo

3D voxel / volumetric plot with RGB colors

3D voxel / volumetric plot with RGB colors

3D voxel / volumetric plot with cylindrical coordinates

3D voxel / volumetric plot with cylindrical coordinates

voxels([x, y, z], filled)

voxels([x, y, z], filled)