
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/mplot3d/3d_bars.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_gallery_mplot3d_3d_bars.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_mplot3d_3d_bars.py:


=====================
Demo of 3D bar charts
=====================

A basic demo of how to plot 3D bars with and without shading.

.. GENERATED FROM PYTHON SOURCE LINES 8-35

.. code-block:: Python


    import matplotlib.pyplot as plt
    import numpy as np

    # set up the figure and Axes
    fig = plt.figure(figsize=(8, 3))
    ax1 = fig.add_subplot(121, projection='3d')
    ax2 = fig.add_subplot(122, projection='3d')

    # fake data
    _x = np.arange(4)
    _y = np.arange(5)
    _xx, _yy = np.meshgrid(_x, _y)
    x, y = _xx.ravel(), _yy.ravel()

    top = x + y
    bottom = np.zeros_like(top)
    width = depth = 1

    ax1.bar3d(x, y, bottom, width, depth, top, shade=True)
    ax1.set_title('Shaded')

    ax2.bar3d(x, y, bottom, width, depth, top, shade=False)
    ax2.set_title('Not Shaded')

    plt.show()


.. GENERATED FROM PYTHON SOURCE LINES 36-41

.. tags::
   plot-type: 3D,
   styling: texture,
   plot-type: bar,
   level: beginner


.. _sphx_glr_download_gallery_mplot3d_3d_bars.py:

.. only:: html

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

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

      :download:`Download Jupyter notebook: 3d_bars.ipynb <3d_bars.ipynb>`

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

      :download:`Download Python source code: 3d_bars.py <3d_bars.py>`

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

      :download:`Download zipped: 3d_bars.zip <3d_bars.zip>`


.. only:: html

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

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