Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedNov 27, 2020
edited
Loading

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 callingset_picker(True),_picker would be a
bool and therefore aNumber, so the fallback cases to the patch
linewidth did not occur.

PR Summary

PR Checklist

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

@anntzeranntzer added this to thev3.4.0 milestoneNov 27, 2020
@anntzeranntzerforce-pushed thecollection-pick-radius branch 2 times, most recently from137a3b5 to9766c90CompareNovember 27, 2020 11:25
@anntzeranntzer changed the titleDeprecate setting a Collection's pickradius via set_picker.Deprecate setting a Collection/Patch's pickradius via set_picker.Nov 27, 2020
@anntzeranntzerforce-pushed thecollection-pick-radius branch 2 times, most recently fromebb9240 to6d8f305CompareNovember 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
ContributorAuthor

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 convolutedcall 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, butI'm not too worried about that (if anything the new behavior is moresensical...).)On Patches, note that the old implementation of `_process_radius` waslikely wrong: after calling `set_picker(True)`, `_picker` would be abool and therefore a `Number`, so the fallback cases to the patchlinewidth did not occur.
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 setp toTrue 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 inlines.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

@tacaswelltacaswell 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 inlines.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*canalso
-*deprecated*:For`.Line2D`,`.Patch`and`.Collection`,*picker*canalso

- *deprecated*: For `.Line2D`and `.Collection`, *picker* can also
be a floatthat sets the tolerance for checking whether an event
occurred"on" theartist; 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.

DidPatch not haveset_pickradius before? I'm concerned about deprecating this and adding the replacement API in the same version.

@anntzer
Copy link
ContributorAuthor

We may want to resolve#19039 first.

@QuLogicQuLogic added the status: needs comment/discussionneeds consensus on next step labelJan 5, 2021
@anntzer
Copy link
ContributorAuthor

Superseded per#19039 (comment).

@anntzeranntzer deleted the collection-pick-radius branchJanuary 21, 2021 20:31
@QuLogicQuLogic removed this from thev3.4.0 milestoneMar 16, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@QuLogicQuLogicQuLogic left review comments

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
status: needs comment/discussionneeds consensus on next step
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@tacaswell@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp