Module containing Axes3D, an object which can plot 3D objects on a 2D matplotlib figure.
Bases: matplotlib.axes.Axes
3D axes object.
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.
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
Generate a 3D bar, or multiple bars.
When generating multiple bars, x, y, z have to be arrays. dx, dy, dz can still be scalars.
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()
Plot filled 3D contours.
X, Y, Z: data points.
Keyword arguments are passed on to contour()
Given the 2D view coordinates attempt to guess a 3D coordinate. Looks for the nearest edge to the point and then assumes that the point is at the same z location as the nearest point on the edge.
Return x string formatted. This function will use the attribute self.fmt_xdata if it is callable, else will fall back on the xaxis major formatter
Return y string formatted. This function will use the attribute self.fmt_ydata if it is callable, else will fall back on the yaxis major formatter
Return z string formatted. This function will use the attribute self.fmt_zdata if it is callable, else will fall back on the yaxis major formatter
Create the projection matrix from the current viewing position.
elev stores the elevation angle in the z plane azim stores the azimuth angle in the x,y plane
dist is the distance of the eye viewing point from the object point.
Get 3d world limits.
Get 3D x limits.
Get 3D y limits.
Get 3D z limits.
Set / unset 3D grid.
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()
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. |
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
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
Set xlabel.
Set 3D x limits.
Set ylabel.
Set 3D y limits.
Set zlabel.
Set 3D z limits.
Add text to the plot.
Add text to the plot.
Return a tuple X, Y, Z with a test data set.
Used to generate more comprehensible numbers in status bar
Module containing 3D artist code and functions to convert 2D artists into 3D versions which can be added to an Axes3D.
Bases: matplotlib.lines.Line2D
3D line object.
Bases: matplotlib.collections.LineCollection
A collection of 3D lines.
Project the points according to renderer matrix.
Set 3D segments
Bases: matplotlib.patches.Patch
3D patch object.
Bases: matplotlib.collections.PatchCollection
A collection of 3D patches.
Bases: matplotlib.collections.PolyCollection
A collection of 3D polygons.
Create a Poly3DCollection.
verts should contain 3D coordinates.
Note that this class does a bit of magic with the _facecolors and _edgecolors properties.
Perform the 3D projection for this object.
Optimize points for projection
Set 3D vertices.
Bases: matplotlib.text.Text
Text object with 3D position and (in the future) direction.
Stretch the color argument to provide the required number num
Return a list of vertices for the path of a patch.
Reorder coordinates so that zdir
Convert a 2D line to 3D.
Convert a LineCollection to a Line3DCollection object.
Return angle between -180 and +180
Return angle between -90 and +90
Convert a Patch to a Patch3D object.
Convert a PatchCollection to a Patch3DCollection object.
Convert a path to a 3D segment.
Convert paths from a collection object to 3D segments.
Convert a PolyCollection to a Poly3DCollection object.
Convert a Text to a Text3D object.
Modify the alphas of the color list according to depth
Various transforms used for by the 3D code
Return 2D equation of line in the form ax+by+c = 0
Distance from line to point line is a tuple of coefficients a,b,c
distance(s) from line defined by p1 - p2 to point(s) p0
p0[0] = x(s) p0[1] = y(s)
intersection point p = p1 + u*(p2-p1) and intersection point lies within segement if u is between 0 and 1
3d vector length
Transform the points by the projection matrix
Transform the points by the projection matrix and return the clipping result returns txs,tys,tzs,tis
Transform the points by the projection matrix