diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index d4eef7ca77e6..6730453aa666 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -19,7 +19,7 @@ import numpy as np -from matplotlib import _api, cbook, docstring +from matplotlib import _api, cbook, docstring, _preprocess_data import matplotlib.artist as martist import matplotlib.axes as maxes import matplotlib.collections as mcoll @@ -2075,6 +2075,7 @@ def add_contourf_set(self, cset, zdir='z', offset=None): art3d.poly_collection_2d_to_3d(linec, z, zdir=zdir) linec.set_sort_zpos(z) + @_preprocess_data() def contour(self, X, Y, Z, *args, extend3d=False, stride=5, zdir='z', offset=None, **kwargs): """ @@ -2093,6 +2094,9 @@ def contour(self, X, Y, Z, *args, offset : float, optional If specified, plot a projection of the contour lines at this position in a plane normal to zdir. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER + *args, **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.contour`. @@ -2111,6 +2115,7 @@ def contour(self, X, Y, Z, *args, contour3D = contour + @_preprocess_data() def tricontour(self, *args, extend3d=False, stride=5, zdir='z', offset=None, **kwargs): """ @@ -2133,6 +2138,8 @@ def tricontour(self, *args, offset : float, optional If specified, plot a projection of the contour lines at this position in a plane normal to zdir. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER *args, **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.tricontour`. @@ -2161,6 +2168,7 @@ def tricontour(self, *args, self.auto_scale_xyz(X, Y, Z, had_data) return cset + @_preprocess_data() def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs): """ Create a 3D filled contour plot. @@ -2174,6 +2182,8 @@ def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs): offset : float, optional If specified, plot a projection of the contour lines at this position in a plane normal to zdir. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER *args, **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.contourf`. @@ -2192,6 +2202,7 @@ def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs): contourf3D = contourf + @_preprocess_data() def tricontourf(self, *args, zdir='z', offset=None, **kwargs): """ Create a 3D filled contour plot. @@ -2209,6 +2220,8 @@ def tricontourf(self, *args, zdir='z', offset=None, **kwargs): offset : float, optional If specified, plot a projection of the contour lines at this position in a plane normal to zdir. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER *args, **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.tricontourf`. @@ -2271,6 +2284,9 @@ def add_collection3d(self, col, zs=0, zdir='z'): collection = super().add_collection(col) return collection + @_preprocess_data(replace_names=["xs", "ys", "zs", "s", + "edgecolors", "c", "facecolor", + "facecolors", "color"]) def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, *args, **kwargs): """ @@ -2308,6 +2324,8 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, Whether to shade the scatter markers to give the appearance of depth. Each call to ``scatter()`` will perform its depthshading independently. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER **kwargs All other arguments are passed on to `~.axes.Axes.scatter`. @@ -2342,6 +2360,7 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, scatter3D = scatter + @_preprocess_data() def bar(self, left, height, zs=0, zdir='z', *args, **kwargs): """ Add 2D bar(s). @@ -2357,6 +2376,8 @@ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs): used for all bars. zdir : {'x', 'y', 'z'}, default: 'z' When plotting 2D data, the direction to use as z ('x', 'y' or 'z'). + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.bar`. @@ -2393,6 +2414,7 @@ def bar(self, left, height, zs=0, zdir='z', *args, **kwargs): return patches + @_preprocess_data() def bar3d(self, x, y, z, dx, dy, dz, color=None, zsort='average', shade=True, lightsource=None, *args, **kwargs): """ @@ -2441,6 +2463,9 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None, lightsource : `~matplotlib.colors.LightSource` The lightsource to use when *shade* is True. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER + **kwargs Any additional keyword arguments are passed onto `~.art3d.Poly3DCollection`. @@ -2562,6 +2587,7 @@ def set_title(self, label, fontdict=None, loc='center', **kwargs): self.title.set_y(0.92 * y) return ret + @_preprocess_data() def quiver(self, *args, length=1, arrow_length_ratio=.3, pivot='tail', normalize=False, **kwargs): @@ -2599,6 +2625,9 @@ def quiver(self, *args, Whether all arrows are normalized to have the same length, or keep the lengths defined by *u*, *v*, and *w*. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER + **kwargs Any additional keyword arguments are delegated to :class:`~matplotlib.collections.LineCollection` @@ -2927,6 +2956,7 @@ def permutation_matrices(n): return polygons + @_preprocess_data(replace_names=["x", "y", "z", "xerr", "yerr", "zerr"]) def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='', barsabove=False, errorevery=1, ecolor=None, elinewidth=None, 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='', Other Parameters ---------------- + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER + **kwargs All other keyword arguments for styling errorbar lines are passed `~mpl_toolkits.mplot3d.art3d.Line3DCollection`. @@ -3299,6 +3332,7 @@ def get_tightbbox(self, renderer, call_axes_locator=True, batch.append(axis_bb) return mtransforms.Bbox.union(batch) + @_preprocess_data() def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-', bottom=0, label=None, orientation='z'): """ @@ -3350,6 +3384,9 @@ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-', orientation : {'x', 'y', 'z'}, default: 'z' The direction along which stems are drawn. + data : indexable object, optional + DATA_PARAMETER_PLACEHOLDER + Returns ------- `.StemContainer`