Create a new matplotlib.figure.Figure and an Axes3D object in it:
import pylab
fig = pylab.figure()
from mpl_toolkits.mplot3d import Axes3D
ax = Axes3D(fig)
Plot 2D or 3D data.
| Argument | Description |
|---|---|
| xs, ys | X, y coordinates of vertices |
| zs | z value(s), either one for all points or one for each point. |
| zdir | Which direction to use as z (‘x’, ‘y’ or ‘z’) when plotting a 2d set. |
Other arguments are passed on to plot()
[source code, hires.png, pdf]
Create a scatter plot.
| Argument | Description |
|---|---|
| xs, ys | Positions of data points. |
| zs | Either an array of the same length as xs and ys or a single value to place all points in the same plane. Default is 0. |
| zdir | Which direction to use as z (‘x’, ‘y’ or ‘z’) when plotting a 2d set. |
Keyword arguments are passed on to scatter().
Returns a Patch3DCollection
[source code, hires.png, pdf]
Plot a 3D wireframe.
| Argument | Description |
|---|---|
| X, Y, | Data values as numpy.arrays |
| Z | |
| rstride | Array row stride (step size) |
| cstride | Array column stride (step size) |
Keyword arguments are passed on to matplotlib.collections.LineCollection.__init__().
Returns a Line3DCollection
[source code, hires.png, pdf]
Create a surface plot.
By default it will be colored in shades of a solid color, but it also supports color mapping by supplying the cmap argument.
| Argument | Description |
|---|---|
| X, Y, | Data values as numpy.arrays |
| Z | |
| rstride | Array row stride (step size) |
| cstride | Array column stride (step size) |
| color | Color of the surface patches |
| cmap | A colormap for the surface patches. |
[source code, hires.png, pdf]
[source code, hires.png, pdf]
Create a 3D contour plot.
| Argument | Description |
|---|---|
| X, Y, | Data values as numpy.arrays |
| Z | |
| levels | Number of levels to use, defaults to 10. Can also be a tuple of specific levels. |
| extend3d | Whether to extend contour in 3D (default: False) |
| stride | Stride (step size) for extending contour |
Other keyword arguments are passed on to contour()
[source code, hires.png, pdf]
[source code, hires.png, pdf]
Plot filled 3D contours.
X, Y, Z: data points.
Keyword arguments are passed on to contour()
[source code, hires.png, pdf]
Add a 3d collection object to the plot.
2D collection types are converted to a 3D version by modifying the object and adding z coordinate information.
[source code, hires.png, pdf]
Add 2D bar(s).
| Argument | Description |
|---|---|
| left | The x coordinates of the left sides of the bars. |
| height | The height of the bars. |
| zs | Z coordinate of bars, if one value is specified they will all be placed at the same z. |
| zdir | Which direction to use as z (‘x’, ‘y’ or ‘z’) when plotting a 2d set. |
Keyword arguments are passed onto bar().
Returns a Patch3DCollection
[source code, hires.png, pdf]