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

Skip to content

Commit f672b59

Browse files
committed
Some more expansion and cleanup of mplot3d docs and examples
Also slightly tweaked the tick label and axis label spacing for improved visualization
1 parent c2705d0 commit f672b59

7 files changed

Lines changed: 32 additions & 18 deletions

File tree

doc/_static/demo_mplot3d.png

42.2 KB
Loading

doc/mpl_toolkits/mplot3d/api.rst

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
***********
44
mplot3d API
55
***********
6+
.. contents::
7+
:backlinks: none
68

7-
:mod:`mpl_toolkits.mplot3d.axes3d`
8-
==================================
9+
.. _toolkit_mplot3d-axesapi:
10+
11+
:mod:`~mpl_toolkits.mplot3d.axes3d`
12+
===================================
913

1014
.. note::
1115
Significant effort went into bringing axes3d to feature-parity with
@@ -17,8 +21,11 @@ mplot3d API
1721
:members:
1822
:show-inheritance:
1923

20-
:mod:`mpl_toolkits.mplot3d.axis3d`
21-
==================================
24+
25+
.. _toolkit_mplot3d-axisapi:
26+
27+
:mod:`~mpl_toolkits.mplot3d.axis3d`
28+
===================================
2229

2330
.. note::
2431
Historically, axis3d has suffered from having hard-coded constants
@@ -33,16 +40,21 @@ mplot3d API
3340
:members:
3441
:show-inheritance:
3542

36-
:mod:`mpl_toolkits.mplot3d.art3d`
37-
=================================
43+
.. _toolkit_mplot3d-artapi:
44+
45+
:mod:`~mpl_toolkits.mplot3d.art3d`
46+
==================================
3847

3948
.. automodule:: mpl_toolkits.mplot3d.art3d
4049
:members:
4150
:show-inheritance:
4251

43-
:mod:`mpl_toolkits.mplot3d.proj3d`
44-
==================================
52+
.. _toolkit_mplot3d-projapi:
53+
54+
:mod:`~mpl_toolkits.mplot3d.proj3d`
55+
===================================
4556

4657
.. automodule:: mpl_toolkits.mplot3d.proj3d
4758
:members:
4859
:show-inheritance:
60+

doc/mpl_toolkits/mplot3d/faq.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ I don't like how the 3D plot is laid out, how do I change that?
4646
Historically, mplot3d has suffered from a hard-coding of parameters used
4747
to control visuals such as label spacing, tick length, and grid line width.
4848
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 for axis3d
50-
in :doc:`_toolkit_mplot3d-api` for more information.
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.
5152

doc/mpl_toolkits/mplot3d/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ The mplot3d toolkit adds simple 3D plotting capabilities to matplotlib by
1111
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

14+
.. image:: ../../_static/demo_mplot3d.png
15+
1416
The interactive backends also provide the ability to rotate and zoom
1517
the 3D scene. One can rotate the 3D scene by simply clicking-and-dragging
1618
the scene. Zooming is done by right-clicking the scene and dragging the

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

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def __init__(self, adir, v_intervalx, d_intervalx, axes, *args, **kwargs):
7575
# This is a temporary member variable.
7676
# Do not depend on this existing in future releases!
7777
self._axinfo = self._AXINFO[adir].copy()
78-
self._axinfo.update({'label' : {'space_factor': 1.3,
78+
self._axinfo.update({'label' : {'space_factor': 1.6,
7979
'va': 'center',
8080
'ha': 'center'},
8181
'tick' : {'inward_factor': 0.2,
8282
'outward_factor': 0.1},
83-
'ticklabel': {'space_factor': 0.6},
83+
'ticklabel': {'space_factor': 0.7},
8484
'axisline': {'linewidth': 0.75,
8585
'color': (0, 0, 0, 1)},
8686
'grid' : {'color': (0.9, 0.9, 0.9, 1),

0 commit comments

Comments
 (0)