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

Deprecate setting a Collection/Patch's pickradius via set_picker. #19026

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

Closed
wants to merge 1 commit into from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 27, 2020

This is the same deprecation as the one introduced for Line2D in 3.3.

(The exact deprecation strategy used here may already break convoluted
call sequences on Collections: calling
coll.set_pickradius(3); coll.set_picker(5); coll.set_picker(False); coll.set_picker(True)
will leave the pickradius at 5 instead of 3 as was the case before, but
I'm not too worried about that (if anything the new behavior is more
sensical...).)

On Patches, note that the old implementation of _process_radius was
likely wrong: after calling set_picker(True), _picker would be a
bool and therefore a Number, so the fallback cases to the patch
linewidth did not occur.

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@anntzer anntzer added this to the v3.4.0 milestone Nov 27, 2020
@anntzer anntzer force-pushed the collection-pick-radius branch 2 times, most recently from 137a3b5 to 9766c90 Compare November 27, 2020 11:25
@anntzer anntzer changed the title Deprecate setting a Collection's pickradius via set_picker. Deprecate setting a Collection/Patch's pickradius via set_picker. Nov 27, 2020
@anntzer anntzer force-pushed the collection-pick-radius branch 2 times, most recently from ebb9240 to 6d8f305 Compare November 27, 2020 14:55
@@ -409,8 +409,9 @@ def test_picking_callbacks_overlap(big_on_axes, small_on_axes, click_on):
# In each case we expect that both rectangles are picked if we click on the
# small one and only the big one is picked if we click on the big one.
# Also tests picking on normal axes ("gca") as a control.
big = plt.Rectangle((0.25, 0.25), 0.5, 0.5, picker=5)
small = plt.Rectangle((0.4, 0.4), 0.2, 0.2, facecolor="r", picker=5)
big = plt.Rectangle((0.25, 0.25), 0.5, 0.5, picker=True, pickradius=5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you want to keep one of these for the test coverage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

This is the same deprecation as the one introduced for Line2D in 3.3.

(The exact deprecation strategy used here may already break convoluted
call sequences on Collections: calling
`coll.set_pickradius(3); coll.set_picker(5); coll.set_picker(False); coll.set_picker(True)`
will leave the pickradius at 5 instead of 3 as was the case before, but
I'm not too worried about that (if anything the new behavior is more
sensical...).)

On Patches, note that the old implementation of `_process_radius` was
likely wrong: after calling `set_picker(True)`, `_picker` would be a
bool and therefore a `Number`, so the fallback cases to the patch
linewidth did not occur.
@anntzer anntzer force-pushed the collection-pick-radius branch from 4cf5368 to ebd6803 Compare November 28, 2020 13:27
Setting pickradius on Collections and Patches via ``set_picker``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Setting the pickradius (i.e. the tolerance for pick events and containment
checks)of a `.Collection` or a `.Patch` via `.Artist.set_picker` is deprecated;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
checks)of a `.Collection` or a `.Patch` via `.Artist.set_picker` is deprecated;
checks) of a `.Collection` or a `.Patch` via `.Artist.set_picker` is deprecated;

"3.4", message="Setting the collections's pick radius via "
"set_picker is deprecated since %(since)s and will be removed "
"%(removal)s; use set_pickradius instead.")
self.set_pickradius(p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you then set p to True since you've removed the type checks later?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and probably make the same change in lines.py as well?

"3.4", message="Setting the collections's pick radius via "
"set_picker is deprecated since %(since)s and will be removed "
"%(removal)s; use set_pickradius instead.")
self.set_pickradius(p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 in principle, but concerned about Patch.

"3.4", message="Setting the collections's pick radius via "
"set_picker is deprecated since %(since)s and will be removed "
"%(removal)s; use set_pickradius instead.")
self.set_pickradius(p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and probably make the same change in lines.py as well?

that sets the tolerance for checking whether an event occurred
"on" the line; this is deprecated. Use `.Line2D.set_pickradius`
instead.
- *deprecated*: For `.Line2D` and `.Collection`, *picker* can also
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- *deprecated*: For `.Line2D` and `.Collection`, *picker* can also
- *deprecated*: For `.Line2D`, `.Patch` and `.Collection`, *picker* can also

- *deprecated*: For `.Line2D` and `.Collection`, *picker* can also
be a float that sets the tolerance for checking whether an event
occurred "on" the artist; this is deprecated. Use
`.Line2D.set_pickradius`/`.Collection.set_pickradius` instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`.Line2D.set_pickradius`/`.Collection.set_pickradius` instead.
`.Line2D.set_pickradius`/`.Collection.set_pickradius`/`.Patch.set_pickradius`
instead.

self.set_pickradius(p)
self._picker = p

def set_pickradius(self, d):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did Patch not have set_pickradius before? I'm concerned about deprecating this and adding the replacement API in the same version.

@anntzer
Copy link
Contributor Author

anntzer commented Dec 19, 2020

We may want to resolve #19039 first.

@QuLogic QuLogic added the status: needs comment/discussion needs consensus on next step label Jan 5, 2021
@anntzer
Copy link
Contributor Author

anntzer commented Jan 21, 2021

Superseded per #19039 (comment).

@anntzer anntzer closed this Jan 21, 2021
@anntzer anntzer deleted the collection-pick-radius branch January 21, 2021 20:31
@QuLogic QuLogic removed this from the v3.4.0 milestone Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs comment/discussion needs consensus on next step
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.