Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b95bce

Browse files
committed
Major revision of mplot3d documentation, including the addition of a faq.
1 parent 119b144 commit 9b95bce

6 files changed

Lines changed: 238 additions & 27 deletions

File tree

doc/mpl_toolkits/mplot3d/api.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
1+
.. _toolkit_mplot3d-api:
2+
13
***********
24
mplot3d API
35
***********
46

57
:mod:`mpl_toolkits.mplot3d.axes3d`
68
==================================
79

10+
.. note::
11+
Significant effort went into bringing axes3d to feature-parity with
12+
regular axes objects for version 1.1.0. However, more work remains.
13+
Please report any functions that do not behave as expected as a bug.
14+
In addition, help and patches would be greatly appreciated!
15+
816
.. automodule:: mpl_toolkits.mplot3d.axes3d
917
:members:
1018
:show-inheritance:
1119

20+
:mod:`mpl_toolkits.mplot3d.axis3d`
21+
==================================
22+
23+
.. note::
24+
Historically, axis3d has suffered from having hard-coded constants
25+
controlling the look and feel of the 3d plot. This precluded user
26+
level adjustments such as label spacing, font colors and panel colors.
27+
For version 1.1.0, these constants have been consolidated into a single
28+
private member dictionary, `self._axinfo`, for the axis object. This is
29+
intended only as a stop-gap measure to allow user-level customization,
30+
but it is not intended to be permanent.
31+
32+
.. automodule:: mpl_toolkits.mplot3d.axis3d
33+
:members:
34+
:show-inheritance:
35+
1236
:mod:`mpl_toolkits.mplot3d.art3d`
1337
=================================
1438

doc/mpl_toolkits/mplot3d/faq.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. _toolkit_mplot3d-faq:
2+
3+
***********
4+
mplot3d FAQ
5+
***********
6+
7+
How is mplot3d different from MayaVi?
8+
=====================================
9+
`MayaVi2 <http://code.enthought.com/projects/mayavi/documentation.php>`_ is a very powerful and featureful 3D graphing library. For advanced
10+
3D scenes and excellent rendering capabilities, it is highly recomended to
11+
use MayaVi2.
12+
13+
mplot3d was intended to allow users to create simple 3D graphs with the same
14+
"look-and-feel" as matplotlib's 2D plots. Furthermore, users can use the same
15+
toolkit that they are already familiar with to generate both their 2D and 3D
16+
plots.
17+
18+
19+
My 3D plot doesn't look right at certain viewing angles
20+
=======================================================
21+
This is probably the most commonly reported issue with mplot3d. The problem
22+
is that -- from some viewing angles -- some 3D objects would appear in front
23+
of another object, even though it is physically behind it. This can result in
24+
plots that do not look "physically correct."
25+
26+
Unfortunately, while some work is being done to reduce the occurance of this
27+
artifact, it is currently an intractable problem, and can not be fully solved
28+
until matplotlib supports 3D graphics rendering at its core.
29+
30+
The problem occurs due to the reduction of 3D data down to 2D + z-order
31+
scalar. A single value represents the 3rd dimention for all parts of 3D
32+
objects in a collection. Therefore, when the bounding boxes of two collections
33+
intersect, it becomes possible for this artifact to occur. Furthermore, the
34+
intersection of two 3D objects (such as polygons or patches) can not be
35+
rendered properly in matplotlib's 2D rendering engine.
36+
37+
This problem will likely not be solved until OpenGL support is added to all of
38+
the backends (patches are greatly welcomed). Until then, if you need complex
39+
3D scenes, we recommend using
40+
`MayaVi <http://code.enthought.com/projects/mayavi/documentation.php>`_.
41+
42+
43+
I don't like how the 3D plot is laid out, how do I change that?
44+
===============================================================
45+
Historically, mplot3d has suffered from a hard-coding of parameters used
46+
to control visuals such as label spacing, tick length, and grid line width.
47+
Work is being done to eliminate this issue. For matplotlib v1.1.0, there is
48+
a semi-official manner to modify these parameters. See the note for axis3d
49+
in :doc:`_toolkit_mplot3d-api` for more information.
50+

doc/mpl_toolkits/mplot3d/index.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ mplot3d
88
Matplotlib mplot3d toolkit
99
==========================
1010
The mplot3d toolkit adds simple 3d plotting capabilities to matplotlib by
11-
supplying an axis object that can create a 2d projection of a 3d scene.
11+
supplying an axes object that can create a 2d projection of a 3d scene.
1212
The resulting graph will have the same look and feel as regular 2d plots.
1313

1414
The interactive backends also provide the ability to rotate and zoom
15-
the 3d scene.
15+
the 3d scene. One can rotate the 3d scene by simply clicking-and-dragging
16+
the scene. Zooming is done by right-clicking the scene and dragging the
17+
mouse up and down. Note that one does not use the zoom button like one
18+
would use for regular 2d plots.
1619

1720
.. toctree::
1821
:maxdepth: 2
1922

2023
tutorial.rst
2124
api.rst
22-
25+
faq.rst

examples/mplot3d/contour3d_demo3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
cset = ax.contour(X, Y, Z, zdir='y', offset=40)
1111

1212
ax.set_xlabel('X')
13-
ax.set_xlim3d(-40, 40)
13+
ax.set_xlim(-40, 40)
1414
ax.set_ylabel('Y')
15-
ax.set_ylim3d(-40, 40)
15+
ax.set_ylim(-40, 40)
1616
ax.set_zlabel('Z')
17-
ax.set_zlim3d(-100, 100)
17+
ax.set_zlim(-100, 100)
1818

1919
plt.show()
2020

examples/mplot3d/contourf3d_demo2.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""
2+
.. versionadded:: 1.1.0
3+
This demo depends on new features added to contourf3d.
4+
"""
5+
16
from mpl_toolkits.mplot3d import axes3d
27
import matplotlib.pyplot as plt
38

@@ -10,11 +15,11 @@
1015
cset = ax.contourf(X, Y, Z, zdir='y', offset=40)
1116

1217
ax.set_xlabel('X')
13-
ax.set_xlim3d(-40, 40)
18+
ax.set_xlim(-40, 40)
1419
ax.set_ylabel('Y')
15-
ax.set_ylim3d(-40, 40)
20+
ax.set_ylim(-40, 40)
1621
ax.set_zlabel('Z')
17-
ax.set_zlim3d(-100, 100)
22+
ax.set_zlim(-100, 100)
1823

1924
plt.show()
2025

0 commit comments

Comments
 (0)