1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
.. redirect-from:: /tutorials/toolkits/mplot3d
.. _mplot3d:
===================
The mplot3d toolkit
===================
Generating 3D plots using the mplot3d toolkit.
This tutorial showcases various 3D plots. Click on the figures to see each full
gallery example with the code that generates the figures.
.. contents::
:backlinks: none
3D Axes (of class `.Axes3D`) are created by passing the ``projection="3d"``
keyword argument to `.Figure.add_subplot`::
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
Multiple 3D subplots can be added on the same figure, as for 2D subplots.
.. figure:: /gallery/mplot3d/images/sphx_glr_subplot3d_001.png
:target: /gallery/mplot3d/subplot3d.html
:align: center
.. versionchanged:: 3.2.0
Prior to Matplotlib 3.2.0, it was necessary to explicitly import the
:mod:`mpl_toolkits.mplot3d` module to make the '3d' projection to
`.Figure.add_subplot`.
See the :ref:`toolkit_mplot3d-faq` for more information about the mplot3d
toolkit.
.. _plot3d:
Line plots
==========
See `.Axes3D.plot` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_lines3d_001.png
:target: /gallery/mplot3d/lines3d.html
:align: center
.. _scatter3d:
Scatter plots
=============
See `.Axes3D.scatter` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_scatter3d_001.png
:target: /gallery/mplot3d/scatter3d.html
:align: center
.. _wireframe:
Wireframe plots
===============
See `.Axes3D.plot_wireframe` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_wire3d_001.png
:target: /gallery/mplot3d/wire3d.html
:align: center
.. _surface:
Surface plots
=============
See `.Axes3D.plot_surface` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_surface3d_001.png
:target: /gallery/mplot3d/surface3d.html
:align: center
.. _trisurface:
Tri-Surface plots
=================
See `.Axes3D.plot_trisurf` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_trisurf3d_001.png
:target: /gallery/mplot3d/trisurf3d.html
:align: center
.. _contour3d:
Contour plots
=============
See `.Axes3D.contour` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_contour3d_001.png
:target: /gallery/mplot3d/contour3d.html
:align: center
.. _contourf3d:
Filled contour plots
====================
See `.Axes3D.contourf` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_contourf3d_001.png
:target: /gallery/mplot3d/contourf3d.html
:align: center
.. versionadded:: 1.1.0
The feature demoed in the second contourf3d example was enabled as a
result of a bugfix for version 1.1.0.
.. _fillbetween3d:
Fill between 3D lines
=====================
See `.Axes3D.fill_between` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_fillbetween3d_001.png
:target: /gallery/mplot3d/fillbetween3d.html
:align: center
.. versionadded:: 3.10
.. _polygon3d:
Polygon plots
=============
See `.Axes3D.add_collection3d` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_polys3d_001.png
:target: /gallery/mplot3d/polys3d.html
:align: center
.. _bar3d:
Bar plots
=========
See `.Axes3D.bar` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_bars3d_001.png
:target: /gallery/mplot3d/bars3d.html
:align: center
.. _quiver3d:
Quiver
======
See `.Axes3D.quiver` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_quiver3d_001.png
:target: /gallery/mplot3d/quiver3d.html
:align: center
.. _2dcollections3d:
2D plots in 3D
==============
.. figure:: /gallery/mplot3d/images/sphx_glr_2dcollections3d_001.png
:target: /gallery/mplot3d/2dcollections3d.html
:align: center
.. _text3d:
Text
====
See `.Axes3D.text` for API documentation.
.. figure:: /gallery/mplot3d/images/sphx_glr_text3d_001.png
:target: /gallery/mplot3d/text3d.html
:align: center
|