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

artist.set_picker(False) no longer keeps artists pickable #19031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 7 doc/api/next_api_changes/behavior/19031-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
``artist.set_picker(False)`` disables artist picking
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Previously, setting the ``picker`` property of an artist to any non-None value,
including ``False``, would keep picking enabled. This was deemed a bug;
now, truthy values enable picking and falsy ones disable it. The default is
now ``False`` instead of ``None``, but both mean that picking is disabled by
default.
14 changes: 6 additions & 8 deletions 14 lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __init__(self):
self._clippath = None
self._clipon = True
self._label = ''
self._picker = None
self._picker = False
self._contains = None
self._rasterized = False
self._agg_filter = None
Expand Down Expand Up @@ -496,7 +496,7 @@ def pickable(self):
--------
set_picker, get_picker, pick
"""
return self.figure is not None and self._picker is not None
return self.figure is not None and self._picker

def pick(self, mouseevent):
"""
Expand Down Expand Up @@ -539,14 +539,12 @@ def set_picker(self, picker):

Parameters
----------
picker : None or bool or callable
picker : bool or callable
This can be one of the following:

- *None*: Picking is disabled for this artist (default).

- A boolean: If *True* then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist.
- A boolean: Whether picking is enabled, i.e. whether the
artist fires a pick event when the mouse event occurs over
the artist. The default is False, i.e. picking is disabled.

- A function: If picker is callable, it is a user supplied
function which determines whether the artist is hit by the
Expand Down
3 changes: 2 additions & 1 deletion 3 lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def get_verts(self):
def _process_radius(self, radius):
if radius is not None:
return radius
if isinstance(self._picker, Number):
if (isinstance(self._picker, Number)
and not isinstance(self._picker, bool)):
_radius = self._picker
else:
if self.get_edgecolor()[3] == 0:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.