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

Skip to content

Commit b9569cc

Browse files
committed
Merge branch 'mplot3d/consistency'
Conflicts: CHANGELOG lib/mpl_toolkits/mplot3d/axes3d.py
2 parents 581e60b + f672b59 commit b9569cc

12 files changed

Lines changed: 858 additions & 153 deletions

File tree

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
2011-07-10 Fixed argument handling error in tripcolor/triplot/tricontour,
22
issue #203. - IMT
33

4+
2011-07-08 Many functions added to mplot3d.axes3d to bring Axes3D
5+
objects more feature-parity with regular Axes objects.
6+
Significant revisions to the documentation as well.
7+
- BVR
8+
49
2011-06-28 3D versions of scatter, plot, plot_wireframe, plot_surface,
510
bar3d, and some other functions now support empty inputs. - BVR
611

doc/_static/demo_mplot3d.png

42.2 KB
Loading

doc/mpl_toolkits/mplot3d/api.rst

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,60 @@
1+
.. _toolkit_mplot3d-api:
2+
13
***********
24
mplot3d API
35
***********
6+
.. contents::
7+
:backlinks: none
48

5-
:mod:`mpl_toolkits.mplot3d.axes3d`
6-
==================================
9+
.. _toolkit_mplot3d-axesapi:
10+
11+
:mod:`~mpl_toolkits.mplot3d.axes3d`
12+
===================================
13+
14+
.. note::
15+
Significant effort went into bringing axes3d to feature-parity with
16+
regular axes objects for version 1.1.0. However, more work remains.
17+
Please report any functions that do not behave as expected as a bug.
18+
In addition, help and patches would be greatly appreciated!
719

820
.. automodule:: mpl_toolkits.mplot3d.axes3d
921
:members:
1022
:show-inheritance:
1123

12-
:mod:`mpl_toolkits.mplot3d.art3d`
13-
=================================
1424

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

19-
:mod:`mpl_toolkits.mplot3d.proj3d`
43+
.. _toolkit_mplot3d-artapi:
44+
45+
:mod:`~mpl_toolkits.mplot3d.art3d`
2046
==================================
2147

48+
.. automodule:: mpl_toolkits.mplot3d.art3d
49+
:members:
50+
:show-inheritance:
51+
52+
.. _toolkit_mplot3d-projapi:
53+
54+
:mod:`~mpl_toolkits.mplot3d.proj3d`
55+
===================================
56+
2257
.. automodule:: mpl_toolkits.mplot3d.proj3d
2358
:members:
2459
:show-inheritance:
60+

doc/mpl_toolkits/mplot3d/faq.rst

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

doc/mpl_toolkits/mplot3d/index.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ mplot3d
77

88
Matplotlib mplot3d toolkit
99
==========================
10-
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.
12-
The resulting graph will have the same look and feel as regular 2d plots.
10+
The mplot3d toolkit adds simple 3D plotting capabilities to matplotlib by
11+
supplying an axes object that can create a 2D projection of a 3D scene.
12+
The resulting graph will have the same look and feel as regular 2D plots.
13+
14+
.. image:: ../../_static/demo_mplot3d.png
1315

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

1722
.. toctree::
1823
:maxdepth: 2
1924

2025
tutorial.rst
2126
api.rst
22-
27+
faq.rst

doc/mpl_toolkits/mplot3d/tutorial.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ add a new axes to it of type :class:`~mpl_toolkits.mplot3d.Axes3D`::
2222
ax = fig.add_subplot(111, projection='3d')
2323

2424
.. versionadded:: 1.0.0
25-
This approach is the preferred method of creating a 3d axes.
25+
This approach is the preferred method of creating a 3D axes.
2626

2727
.. note::
28-
Prior to version 1.0.0, the method of creating a 3d axes was
28+
Prior to version 1.0.0, the method of creating a 3D axes was
2929
different. For those using older versions of matplotlib, change
3030
``ax = fig.add_subplot(111, projection='3d')``
3131
to ``ax = Axes3D(fig)``.
@@ -121,12 +121,12 @@ Text
121121

122122
Subplotting
123123
====================
124-
Having multiple 3d plots in a single figure is the same
125-
as it is for 2d plots. Also, you can have both 2d and 3d plots
124+
Having multiple 3D plots in a single figure is the same
125+
as it is for 2D plots. Also, you can have both 2D and 3D plots
126126
in the same figure.
127127

128128
.. versionadded:: 1.0.0
129-
Subplotting 3d plots was added in v1.0.0. Earlier version can not
129+
Subplotting 3D plots was added in v1.0.0. Earlier version can not
130130
do this.
131131

132132
.. plot:: mpl_examples/mplot3d/subplot3d_demo.py

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

examples/mplot3d/surface3d_demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from mpl_toolkits.mplot3d import Axes3D
22
from matplotlib import cm
3-
from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter
3+
from matplotlib.ticker import LinearLocator, FormatStrFormatter
44
import matplotlib.pyplot as plt
55
import numpy as np
66

@@ -13,10 +13,10 @@
1313
Z = np.sin(R)
1414
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet,
1515
linewidth=0, antialiased=False)
16-
ax.set_zlim3d(-1.01, 1.01)
16+
ax.set_zlim(-1.01, 1.01)
1717

18-
ax.w_zaxis.set_major_locator(LinearLocator(10))
19-
ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f'))
18+
ax.zaxis.set_major_locator(LinearLocator(10))
19+
ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
2020

2121
fig.colorbar(surf, shrink=0.5, aspect=5)
2222

examples/mplot3d/surface3d_demo3.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from mpl_toolkits.mplot3d import Axes3D
22
from matplotlib import cm
3-
from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter
3+
from matplotlib.ticker import LinearLocator
44
import matplotlib.pyplot as plt
55
import numpy as np
66

@@ -25,7 +25,6 @@
2525

2626
ax.set_zlim3d(-1, 1)
2727
ax.w_zaxis.set_major_locator(LinearLocator(6))
28-
ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f'))
2928

3029
plt.show()
3130

0 commit comments

Comments
 (0)