.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python_packages\matplotlib\demo_scatter3d.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_python_packages_matplotlib_demo_scatter3d.py: Scatter 3D ============= .. GENERATED FROM PYTHON SOURCE LINES 5-28 .. image-sg:: /11_demos/python_packages/matplotlib/images/sphx_glr_demo_scatter3d_001.png :alt: demo scatter3d :srcset: /11_demos/python_packages/matplotlib/images/sphx_glr_demo_scatter3d_001.png :class: sphx-glr-single-img .. code-block:: default import numpy as np import matplotlib.pyplot as plt def randrange(n, vmin, vmax): return (vmax - vmin) * np.random.rand(n) + vmin fig = plt.figure() ax = fig.add_subplot(111, projection="3d") n = 100 for c, m, zl, zh in [("r", "o", -50, -25), ("b", "^", -30, -5)]: xs = randrange(n, 23, 32) ys = randrange(n, 0, 100) zs = randrange(n, zl, zh) ax.scatter(xs, ys, zs, c=c, marker=m) ax.set_xlabel("X Label") ax.set_ylabel("Y Label") ax.set_zlabel("Z Label") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.116 seconds) .. _sphx_glr_download_11_demos_python_packages_matplotlib_demo_scatter3d.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_scatter3d.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_scatter3d.ipynb `