Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60cb031

Browse filesBrowse files
authored
Validate Line2D pickradius when setting it, not when reading i… (#16134)
Validate Line2D pickradius when setting it, not when reading it.
2 parents a7f136e + 969a485 commit 60cb031
Copy full SHA for 60cb031

File tree

1 file changed

+6
-5
lines changed
Filter options

1 file changed

+6
-5
lines changed

‎lib/matplotlib/lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/lines.py
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,6 @@ def contains(self, mouseevent):
444444
if inside is not None:
445445
return inside, info
446446

447-
if not isinstance(self.pickradius, Number):
448-
raise ValueError("pick radius should be a distance")
449-
450447
# Make sure we have data to plot
451448
if self._invalidy or self._invalidx:
452449
self.recache()
@@ -495,7 +492,7 @@ def get_pickradius(self):
495492
496493
See `.contains` for more details.
497494
"""
498-
return self.pickradius
495+
return self._pickradius
499496

500497
def set_pickradius(self, d):
501498
"""Set the pick radius used for containment tests.
@@ -507,7 +504,11 @@ def set_pickradius(self, d):
507504
d : float
508505
Pick radius, in points.
509506
"""
510-
self.pickradius = d
507+
if not isinstance(d, Number) or d < 0:
508+
raise ValueError("pick radius should be a distance")
509+
self._pickradius = d
510+
511+
pickradius = property(get_pickradius, set_pickradius)
511512

512513
def get_fillstyle(self):
513514
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.