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

Skip to content

Commit 20b8b76

Browse files
committed
Proof of concept "accepts units" decorator
1 parent 90437e4 commit 20b8b76

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import matplotlib.ticker as mticker
3434
import matplotlib.transforms as mtransforms
3535
import matplotlib.tri as mtri
36+
import matplotlib.units as munits
3637
from matplotlib.cbook import (
3738
mplDeprecation, warn_deprecated, STEP_LOOKUP_MAP, iterable,
3839
safe_first_element)
@@ -3844,6 +3845,7 @@ def dopatch(xs, ys, **kwargs):
38443845
return dict(whiskers=whiskers, caps=caps, boxes=boxes,
38453846
medians=medians, fliers=fliers, means=means)
38463847

3848+
@munits._accepts_units(self, convert_x=[1], convert_y=[2])
38473849
@_preprocess_data(replace_names=["x", "y", "s", "linewidths",
38483850
"edgecolors", "c", "facecolor",
38493851
"facecolors", "color"],
@@ -3990,9 +3992,6 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39903992
if edgecolors is None and not rcParams['_internal.classic_mode']:
39913993
edgecolors = 'face'
39923994

3993-
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
3994-
x = self.convert_xunits(x)
3995-
y = self.convert_yunits(y)
39963995

39973996
# np.ma.ravel yields an ndarray, not a masked array,
39983997
# unless its argument is a masked array.

0 commit comments

Comments
 (0)