Skip to content

Commit 338948e

Browse files
author
Oscar Gustafsson
committed
[Doc] Improve/correct docs for 3D
1 parent ca946ac commit 338948e

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,17 @@ def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
826826
827827
Parameters
828828
----------
829+
col : `~matplotlib.collections.PatchCollection` or \
830+
`~matplotlib.collections.PathCollection`
831+
The collection to convert.
829832
zs : float or array of floats
830833
The location or locations to place the patches in the collection along
831834
the *zdir* axis. Default: 0.
832835
zdir : {'x', 'y', 'z'}
833836
The axis in which to place the patches. Default: "z".
834837
See `.get_dir_vector` for a description of the values.
835-
depthshade
836-
Whether to shade the patches to give a sense of depth. Default: *True*.
838+
depthshade : bool, default: True
839+
Whether to shade the patches to give a sense of depth.
837840
838841
"""
839842
if isinstance(col, PathCollection):
@@ -1117,6 +1120,8 @@ def poly_collection_2d_to_3d(col, zs=0, zdir='z'):
11171120
11181121
Parameters
11191122
----------
1123+
col : `~matplotlib.collections.PolyCollection`
1124+
The collection to convert.
11201125
zs : float or array of floats
11211126
The location or locations to place the polygons in the collection along
11221127
the *zdir* axis. Default: 0.

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ def plot(self, xs, ys, *args, zdir='z', **kwargs):
18801880
if args and not isinstance(args[0], str):
18811881
zs, *args = args
18821882
if 'zs' in kwargs:
1883-
raise TypeError("plot() for multiple values for argument 'z'")
1883+
raise TypeError("plot() for multiple values for argument 'zs'")
18841884
else:
18851885
zs = kwargs.pop('zs', 0)
18861886

@@ -1943,23 +1943,23 @@ def plot_surface(self, X, Y, Z, *, norm=None, vmin=None,
19431943
color : color-like
19441944
Color of the surface patches.
19451945
1946-
cmap : Colormap
1946+
cmap : Colormap, optional
19471947
Colormap of the surface patches.
19481948
1949-
facecolors : array-like of colors.
1949+
facecolors : array-like of colors
19501950
Colors of each individual patch.
19511951
1952-
norm : Normalize
1952+
norm : `~matplotlib.colors.Normalize`, optional
19531953
Normalization for the colormap.
19541954
1955-
vmin, vmax : float
1955+
vmin, vmax : float, optional
19561956
Bounds for the normalization.
19571957
19581958
shade : bool, default: True
19591959
Whether to shade the facecolors. Shading is always disabled when
19601960
*cmap* is specified.
19611961
1962-
lightsource : `~matplotlib.colors.LightSource`
1962+
lightsource : `~matplotlib.colors.LightSource`, optional
19631963
The lightsource to use when *shade* is True.
19641964
19651965
**kwargs
@@ -2242,14 +2242,14 @@ def plot_trisurf(self, *args, color=None, norm=None, vmin=None, vmax=None,
22422242
Color of the surface patches.
22432243
cmap
22442244
A colormap for the surface patches.
2245-
norm : Normalize
2245+
norm : `~matplotlib.colors.Normalize`, optional
22462246
An instance of Normalize to map values to colors.
2247-
vmin, vmax : float, default: None
2247+
vmin, vmax : float, optional
22482248
Minimum and maximum value to map.
22492249
shade : bool, default: True
22502250
Whether to shade the facecolors. Shading is always disabled when
22512251
*cmap* is specified.
2252-
lightsource : `~matplotlib.colors.LightSource`
2252+
lightsource : `~matplotlib.colors.LightSource`, optional
22532253
The lightsource to use when *shade* is True.
22542254
**kwargs
22552255
All other keyword arguments are passed on to
@@ -2379,7 +2379,7 @@ def contour(self, X, Y, Z, *args,
23792379
Input data. See `.Axes.contour` for supported data shapes.
23802380
extend3d : bool, default: False
23812381
Whether to extend contour in 3D.
2382-
stride : int
2382+
stride : int, default: 5
23832383
Step size for extending contour.
23842384
zdir : {'x', 'y', 'z'}, default: 'z'
23852385
The direction to use.
@@ -2423,7 +2423,7 @@ def tricontour(self, *args,
24232423
Input data. See `.Axes.tricontour` for supported data shapes.
24242424
extend3d : bool, default: False
24252425
Whether to extend contour in 3D.
2426-
stride : int
2426+
stride : int, default: 5
24272427
Step size for extending contour.
24282428
zdir : {'x', 'y', 'z'}, default: 'z'
24292429
The direction to use.
@@ -2558,13 +2558,14 @@ def add_collection3d(self, col, zs=0, zdir='z'):
25582558
Add a 3D collection object to the plot.
25592559
25602560
2D collection types are converted to a 3D version by
2561-
modifying the object and adding z coordinate information.
2561+
modifying the object and adding z coordinate information,
2562+
*zs* and *zdir*.
25622563
2563-
Supported are:
2564+
Supported 2D collection types are:
25642565
2565-
- PolyCollection
2566-
- LineCollection
2567-
- PatchCollection
2566+
- `.PolyCollection`
2567+
- `.LineCollection`
2568+
- `.PatchCollection`
25682569
"""
25692570
zvals = np.atleast_1d(zs)
25702571
zsortval = (np.min(zvals) if zvals.size
@@ -2676,7 +2677,7 @@ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs):
26762677
The x coordinates of the left sides of the bars.
26772678
height : 1D array-like
26782679
The height of the bars.
2679-
zs : float or 1D array-like
2680+
zs : float or 1D array-like, default: 0
26802681
Z coordinate of bars; if a single value is specified, it will be
26812682
used for all bars.
26822683
zdir : {'x', 'y', 'z'}, default: 'z'
@@ -2759,14 +2760,14 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
27592760
5. -X
27602761
6. +X
27612762
2762-
zsort : str, optional
2763+
zsort : {'average', 'min', 'max'}, default: 'average'
27632764
The z-axis sorting scheme passed onto `~.art3d.Poly3DCollection`
27642765
27652766
shade : bool, default: True
27662767
When true, this shades the dark sides of the bars (relative
27672768
to the plot's source of light).
27682769
2769-
lightsource : `~matplotlib.colors.LightSource`
2770+
lightsource : `~matplotlib.colors.LightSource`, optional
27702771
The lightsource to use when *shade* is True.
27712772
27722773
data : indexable object, optional
@@ -3063,7 +3064,7 @@ def voxels(self, *args, facecolors=None, edgecolors=None, shade=True,
30633064
shade : bool, default: True
30643065
Whether to shade the facecolors.
30653066
3066-
lightsource : `~matplotlib.colors.LightSource`
3067+
lightsource : `~matplotlib.colors.LightSource`, optional
30673068
The lightsource to use when *shade* is True.
30683069
30693070
**kwargs

0 commit comments

Comments
 (0)