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

Skip to content

Commit b8dcf0b

Browse files
authored
Merge pull request #20951 from jayjoshi112711/20912-data-kwarg-support-mplot3d
[ENH]: data kwarg support for mplot3d #20912
2 parents ef86a51 + ed53303 commit b8dcf0b

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import numpy as np
2121

22-
from matplotlib import _api, cbook, docstring
22+
from matplotlib import _api, cbook, docstring, _preprocess_data
2323
import matplotlib.artist as martist
2424
import matplotlib.axes as maxes
2525
import matplotlib.collections as mcoll
@@ -2075,6 +2075,7 @@ def add_contourf_set(self, cset, zdir='z', offset=None):
20752075
art3d.poly_collection_2d_to_3d(linec, z, zdir=zdir)
20762076
linec.set_sort_zpos(z)
20772077

2078+
@_preprocess_data()
20782079
def contour(self, X, Y, Z, *args,
20792080
extend3d=False, stride=5, zdir='z', offset=None, **kwargs):
20802081
"""
@@ -2093,6 +2094,9 @@ def contour(self, X, Y, Z, *args,
20932094
offset : float, optional
20942095
If specified, plot a projection of the contour lines at this
20952096
position in a plane normal to zdir.
2097+
data : indexable object, optional
2098+
DATA_PARAMETER_PLACEHOLDER
2099+
20962100
*args, **kwargs
20972101
Other arguments are forwarded to `matplotlib.axes.Axes.contour`.
20982102
@@ -2111,6 +2115,7 @@ def contour(self, X, Y, Z, *args,
21112115

21122116
contour3D = contour
21132117

2118+
@_preprocess_data()
21142119
def tricontour(self, *args,
21152120
extend3d=False, stride=5, zdir='z', offset=None, **kwargs):
21162121
"""
@@ -2133,6 +2138,8 @@ def tricontour(self, *args,
21332138
offset : float, optional
21342139
If specified, plot a projection of the contour lines at this
21352140
position in a plane normal to zdir.
2141+
data : indexable object, optional
2142+
DATA_PARAMETER_PLACEHOLDER
21362143
*args, **kwargs
21372144
Other arguments are forwarded to `matplotlib.axes.Axes.tricontour`.
21382145
@@ -2161,6 +2168,7 @@ def tricontour(self, *args,
21612168
self.auto_scale_xyz(X, Y, Z, had_data)
21622169
return cset
21632170

2171+
@_preprocess_data()
21642172
def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs):
21652173
"""
21662174
Create a 3D filled contour plot.
@@ -2174,6 +2182,8 @@ def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs):
21742182
offset : float, optional
21752183
If specified, plot a projection of the contour lines at this
21762184
position in a plane normal to zdir.
2185+
data : indexable object, optional
2186+
DATA_PARAMETER_PLACEHOLDER
21772187
*args, **kwargs
21782188
Other arguments are forwarded to `matplotlib.axes.Axes.contourf`.
21792189
@@ -2192,6 +2202,7 @@ def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs):
21922202

21932203
contourf3D = contourf
21942204

2205+
@_preprocess_data()
21952206
def tricontourf(self, *args, zdir='z', offset=None, **kwargs):
21962207
"""
21972208
Create a 3D filled contour plot.
@@ -2209,6 +2220,8 @@ def tricontourf(self, *args, zdir='z', offset=None, **kwargs):
22092220
offset : float, optional
22102221
If specified, plot a projection of the contour lines at this
22112222
position in a plane normal to zdir.
2223+
data : indexable object, optional
2224+
DATA_PARAMETER_PLACEHOLDER
22122225
*args, **kwargs
22132226
Other arguments are forwarded to
22142227
`matplotlib.axes.Axes.tricontourf`.
@@ -2271,6 +2284,9 @@ def add_collection3d(self, col, zs=0, zdir='z'):
22712284
collection = super().add_collection(col)
22722285
return collection
22732286

2287+
@_preprocess_data(replace_names=["xs", "ys", "zs", "s",
2288+
"edgecolors", "c", "facecolor",
2289+
"facecolors", "color"])
22742290
def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
22752291
*args, **kwargs):
22762292
"""
@@ -2308,6 +2324,8 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
23082324
Whether to shade the scatter markers to give the appearance of
23092325
depth. Each call to ``scatter()`` will perform its depthshading
23102326
independently.
2327+
data : indexable object, optional
2328+
DATA_PARAMETER_PLACEHOLDER
23112329
**kwargs
23122330
All other arguments are passed on to `~.axes.Axes.scatter`.
23132331
@@ -2342,6 +2360,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,
23422360

23432361
scatter3D = scatter
23442362

2363+
@_preprocess_data()
23452364
def bar(self, left, height, zs=0, zdir='z', *args, **kwargs):
23462365
"""
23472366
Add 2D bar(s).
@@ -2357,6 +2376,8 @@ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs):
23572376
used for all bars.
23582377
zdir : {'x', 'y', 'z'}, default: 'z'
23592378
When plotting 2D data, the direction to use as z ('x', 'y' or 'z').
2379+
data : indexable object, optional
2380+
DATA_PARAMETER_PLACEHOLDER
23602381
**kwargs
23612382
Other arguments are forwarded to `matplotlib.axes.Axes.bar`.
23622383
@@ -2393,6 +2414,7 @@ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs):
23932414

23942415
return patches
23952416

2417+
@_preprocess_data()
23962418
def bar3d(self, x, y, z, dx, dy, dz, color=None,
23972419
zsort='average', shade=True, lightsource=None, *args, **kwargs):
23982420
"""
@@ -2441,6 +2463,9 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
24412463
lightsource : `~matplotlib.colors.LightSource`
24422464
The lightsource to use when *shade* is True.
24432465
2466+
data : indexable object, optional
2467+
DATA_PARAMETER_PLACEHOLDER
2468+
24442469
**kwargs
24452470
Any additional keyword arguments are passed onto
24462471
`~.art3d.Poly3DCollection`.
@@ -2562,6 +2587,7 @@ def set_title(self, label, fontdict=None, loc='center', **kwargs):
25622587
self.title.set_y(0.92 * y)
25632588
return ret
25642589

2590+
@_preprocess_data()
25652591
def quiver(self, *args,
25662592
length=1, arrow_length_ratio=.3, pivot='tail', normalize=False,
25672593
**kwargs):
@@ -2599,6 +2625,9 @@ def quiver(self, *args,
25992625
Whether all arrows are normalized to have the same length, or keep
26002626
the lengths defined by *u*, *v*, and *w*.
26012627
2628+
data : indexable object, optional
2629+
DATA_PARAMETER_PLACEHOLDER
2630+
26022631
**kwargs
26032632
Any additional keyword arguments are delegated to
26042633
:class:`~matplotlib.collections.LineCollection`
@@ -2927,6 +2956,7 @@ def permutation_matrices(n):
29272956

29282957
return polygons
29292958

2959+
@_preprocess_data(replace_names=["x", "y", "z", "xerr", "yerr", "zerr"])
29302960
def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
29312961
barsabove=False, errorevery=1, ecolor=None, elinewidth=None,
29322962
capsize=None, capthick=None, xlolims=False, xuplims=False,
@@ -3022,6 +3052,9 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
30223052
30233053
Other Parameters
30243054
----------------
3055+
data : indexable object, optional
3056+
DATA_PARAMETER_PLACEHOLDER
3057+
30253058
**kwargs
30263059
All other keyword arguments for styling errorbar lines are passed
30273060
`~mpl_toolkits.mplot3d.art3d.Line3DCollection`.
@@ -3292,6 +3325,7 @@ def get_tightbbox(self, renderer, call_axes_locator=True,
32923325
batch.append(axis_bb)
32933326
return mtransforms.Bbox.union(batch)
32943327

3328+
@_preprocess_data()
32953329
def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
32963330
bottom=0, label=None, orientation='z'):
32973331
"""
@@ -3343,6 +3377,9 @@ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
33433377
orientation : {'x', 'y', 'z'}, default: 'z'
33443378
The direction along which stems are drawn.
33453379
3380+
data : indexable object, optional
3381+
DATA_PARAMETER_PLACEHOLDER
3382+
33463383
Returns
33473384
-------
33483385
`.StemContainer`

0 commit comments

Comments
 (0)