Note

Go to the endto download the full example code.

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

Seevoxels.

voxels simple
importmatplotlib.pyplotaspltimportnumpyasnpplt.style.use('_mpl-gallery')# Prepare some coordinatesx,y,z=np.indices((8,8,8))# Draw cuboids in the top left and bottom right cornerscube1=(x<3)&(y<3)&(z<3)cube2=(x>=5)&(y>=5)&(z>=5)# Combine the objects into a single boolean arrayvoxelarray=cube1|cube2# Plotfig,ax=plt.subplots(subplot_kw={"projection":"3d"})ax.voxels(voxelarray,edgecolor='k')ax.set(xticklabels=[],yticklabels=[],zticklabels=[])plt.show()

Gallery generated by Sphinx-Gallery