Skip to content

Commit 8e59326

Browse files
committed
Unify pickradius arguments and checking
1 parent 7c07acf commit 8e59326

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
@@ -433,7 +433,6 @@ def draw(self, renderer):
433433
renderer.close_group(self.__class__.__name__)
434434
self.stale = False
435435

436-
@_api.rename_parameter("3.6", "pr", "pickradius")
437436
def set_pickradius(self, pickradius):
438437
"""
439438
Set the pick radius used for containment tests.
@@ -443,6 +442,9 @@ def set_pickradius(self, pickradius):
443442
pickradius : float
444443
Pick radius, in points.
445444
"""
445+
if not isinstance(pickradius, Number):
446+
raise ValueError(
447+
f"pickradius must be a number, not {pickradius!r}")
446448
self._pickradius = pickradius
447449

448450
def get_pickradius(self):

lib/matplotlib/lines.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def __init__(self, xdata, ydata,
404404
# update kwargs before updating data to give the caller a
405405
# chance to init axes (and hence unit support)
406406
self._internal_update(kwargs)
407-
self._pickradius = pickradius
407+
self.pickradius = pickradius
408408
self.ind_offset = 0
409409
if (isinstance(self._picker, Number) and
410410
not isinstance(self._picker, bool)):
@@ -502,7 +502,6 @@ def get_pickradius(self):
502502
"""
503503
return self._pickradius
504504

505-
@_api.rename_parameter("3.6", "d", "pickradius")
506505
def set_pickradius(self, pickradius):
507506
"""
508507
Set the pick radius used for containment tests.

0 commit comments

Comments
 (0)