
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "plot_types/3D/voxels_simple.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_plot_types_3D_voxels_simple.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_plot_types_3D_voxels_simple.py:


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

See `~mpl_toolkits.mplot3d.axes3d.Axes3D.voxels`.

.. GENERATED FROM PYTHON SOURCE LINES 8-32

.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    plt.style.use('_mpl-gallery')

    # Prepare some coordinates
    x, y, z = np.indices((8, 8, 8))

    # Draw cuboids in the top left and bottom right corners
    cube1 = (x < 3) & (y < 3) & (z < 3)
    cube2 = (x >= 5) & (y >= 5) & (z >= 5)

    # Combine the objects into a single boolean array
    voxelarray = cube1 | cube2

    # Plot
    fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
    ax.voxels(voxelarray, edgecolor='k')

    ax.set(xticklabels=[],
           yticklabels=[],
           zticklabels=[])

    plt.show()


.. _sphx_glr_download_plot_types_3D_voxels_simple.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: voxels_simple.ipynb <voxels_simple.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: voxels_simple.py <voxels_simple.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: voxels_simple.zip <voxels_simple.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
