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

Skip to content

Commit 17c018b

Browse files
committed
Unify pickradius arguments and checking
1 parent 78f9c08 commit 17c018b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/matplotlib/axis.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,7 @@ def __str__(self):
640640
return "{}({},{})".format(
641641
type(self).__name__, *self.axes.transAxes.transform((0, 0)))
642642

643-
@_api.make_keyword_only("3.6", name="pickradius")
644-
def __init__(self, axes, pickradius=15):
643+
def __init__(self, axes, *, pickradius=15):
645644
"""
646645
Parameters
647646
----------

lib/matplotlib/collections.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ def draw(self, renderer):
418418
renderer.close_group(self.__class__.__name__)
419419
self.stale = False
420420

421-
@_api.rename_parameter("3.6", "pr", "pickradius")
422421
def set_pickradius(self, pickradius):
423422
"""
424423
Set the pick radius used for containment tests.
@@ -428,6 +427,9 @@ def set_pickradius(self, pickradius):
428427
pickradius : float
429428
Pick radius, in points.
430429
"""
430+
if not isinstance(pickradius, Number):
431+
raise ValueError(
432+
f"pickradius must be a number, not {pickradius!r}")
431433
self._pickradius = pickradius
432434

433435
def get_pickradius(self):

lib/matplotlib/lines.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def __init__(self, xdata, ydata,
391391
# update kwargs before updating data to give the caller a
392392
# chance to init axes (and hence unit support)
393393
self._internal_update(kwargs)
394-
self._pickradius = pickradius
394+
self.pickradius = pickradius
395395
self.ind_offset = 0
396396
if (isinstance(self._picker, Number) and
397397
not isinstance(self._picker, bool)):
@@ -489,7 +489,6 @@ def get_pickradius(self):
489489
"""
490490
return self._pickradius
491491

492-
@_api.rename_parameter("3.6", "d", "pickradius")
493492
def set_pickradius(self, pickradius):
494493
"""
495494
Set the pick radius used for containment tests.

0 commit comments

Comments
 (0)