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

Add improved modification of QuiverKey properties#18794

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

Draft
QuLogic wants to merge3 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromQuLogic:quiver-key

Conversation

QuLogic
Copy link
Member

PR Summary

QuiverKey previously had several attributes that were saved from the constructor, but these were never linked to the internal Artists that were actually drawn.

This adds getters and setters for said properties, and instead of a separate copy of the information, just grabs/sets it on the internal Text child. Additionally, it deprecates access to these internal children; other than.text, they were always overwritten indraw, so there was no way to make real use of them.

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).

@QuLogicQuLogic added this to thev3.4.0 milestoneOct 23, 2020
@QuLogicQuLogic modified the milestones:v3.4.0,v3.5.0Feb 10, 2021
self._initialized = False
self.zorder = Q.zorder + 0.1

def get_x(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we can do without {get,set}_{x,y} and just stick to get_position (as for Text)? the backcompat X and Y would be kept for backcompat but can use straight lambdas (X = property(lambda self: self._text.get_position()[0], self.text.set_x) -- settingstale shouldn't really matter here as Text will propagate staleness to the parent Axes anyways)

Copy link
Member

Choose a reason for hiding this comment

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

Agree. We only have get_x on Rectangle and FancyBboxPatch. Let's keep the API size down and only provide get/set_position.

self._update_text_transform()
self.stale = True

@property
Copy link
Contributor

Choose a reason for hiding this comment

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

consider deprecating this, given the potential source of confusion?

Copy link
Member

Choose a reason for hiding this comment

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

Agree.


- ``QuiverKey.text``
- ``QuiverKey.vector``
- ``QuiverKey.verts``
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps someone may want e.g. to set usetex or math_fontfamily or whatnot on the Text; do you really want to deprecate access to it?

Copy link
Member

Choose a reason for hiding this comment

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

Keeping text public is the pragmatic thing to do.

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

None of the suggestions above are blocking, but please consider them.

Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

@QuLogic feel free to self-merge if you don't want to address the comments@anntzer left - we can have follow up PRs if helpful.

@jklymakjklymak added the status: needs clarificationIssues that need more information to resolve. labelMay 21, 2021
@jklymakjklymak marked this pull request as draftMay 21, 2021 19:39
@QuLogicQuLogic modified the milestones:v3.5.0,v3.6.0Aug 23, 2021
@timhoffmtimhoffm modified the milestones:v3.6.0,unassignedApr 30, 2022
@story645story645 modified the milestones:unassigned,needs sortingOct 6, 2022
@github-actions
Copy link

Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it.

@github-actionsgithub-actionsbot added the status: inactiveMarked by the “Stale” Github Action labelAug 30, 2023
Additionally, add getters/setters for these properties, and use an`offset_copy` Transform to implement `labelsep`. This makes one lessthing depending on the DPI change signal.
@QuLogic
Copy link
MemberAuthor

I finally got around to rebasing this, though I don't really remember why I started this PR in the first place.

@timhoffm what do you think about the API changes here, mainly the comments from@anntzer? I also had to use[gs]et_label_text instead of[gs]et_label because of conflicting types withArtist, but I realize now that's just from the automaticobject->str cast, and maybe I could allow that in order to go back to the generic name.

@github-actionsgithub-actionsbot removed the status: inactiveMarked by the “Stale” Github Action labelMar 28, 2024
@timhoffm
Copy link
Member

Commented on@anntzer‘s suggestions.

label: Unfortunately, Artist.set_label is tied to the specific meaning: The label an artist gets in a legend. I‘m against repurposing that function for another usecase. See also#27971 (comment).

Can‘t we leave thetext instance public? As far as I’ve understood from your initial comment, that should be technically possible. It’s not too pretty, but saves the forwarding functions as well as preventing the label naming issues. I‘d say that’s the pragmatic approach: Supporting full access for the rare cases a user needs it, but not generating much overhead on our side.

@QuLogic
Copy link
MemberAuthor

Can‘t we leave thetext instance public? As far as I’ve understood from your initial comment, that should be technically possible. It’s not too pretty, but saves the forwarding functions as well as preventing the label naming issues. I‘d say that’s the pragmatic approach: Supporting full access for the rare cases a user needs it, but not generating much overhead on our side.

Yes, that does seem possible; should we deprecate theQuiverKey.label* attributes that previously would not do anything if changed, or keep the (new in this PR) properties?

@timhoffm
Copy link
Member

Let's deprecate all thelabel* attributes direct people to working with theQuiverKey.text instance. That's good enough.QuiverKey in itself is not one of the most used parts of the library, and modifying an existingQuiverKey even less so.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm left review comments

@anntzeranntzeranntzer approved these changes

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Labels
New featurestatus: needs clarificationIssues that need more information to resolve.status: needs rebase
Projects
None yet
Milestone
future releases
Development

Successfully merging this pull request may close these issues.

6 participants
@QuLogic@timhoffm@anntzer@jklymak@story645@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp