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 angle setter/getter to Rectangle #19646

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

Merged
jklymak merged 2 commits into matplotlib:master from dstansby:rect-rotate
Mar 8, 2021
Merged

Conversation

Copy link
Member

@dstansby dstansby commented Mar 5, 2021

This adds an angle property, such that the Rectangle is labelled stale when it is updated. All the other properties use set_ and get_, but to maintain backwards compatibility I've used a property here since Rectangle.angle already existed.

Copy link
Member

timhoffm commented Mar 6, 2021

I propose to add set_ and get_ instead, but leave the storage in the public Rectangle.angle.

This is a consistency issue. We don't have attributes do fancy stuff (and thus have litte public attributes anyway). Defining set_ enables the use with standard mechanisms like rect.set(width=2, angle=30).

We don't need staling on .angle assignment. This has not been working and thus we don't need that for backward compatibility.

We may additionally deprecate .angle, but I'm undecided if that's worth it.

dstansby reacted with thumbs up emoji

@dstansby dstansby changed the title (削除) Add angle property to Rectangle (削除ここまで) (追記) Add angle setter/getter to Rectangle (追記ここまで) Mar 6, 2021
Copy link
Contributor

anntzer commented Mar 7, 2021

My approval still stands, although you made flake8 unhappy :)

Copy link
Member

jklymak commented Mar 7, 2021

Please add tests for the new setters and getters!

@anntzer anntzer removed their request for review March 7, 2021 19:15
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

I don't think a test is strictly necessary for this, but of course @jklymak is right. Leaving open in case you want to add a test. If not, I'd also merge without.

Copy link
Member Author

dstansby commented Mar 8, 2021

Test added. It's a simple figure comparison to make sure that setting the rotation after patch creation does the same thing as setting it in the constructor, with some additional tests for get_angle().

jklymak reacted with thumbs up emoji

@jklymak jklymak merged commit 3df5db5 into matplotlib:master Mar 8, 2021
@dstansby dstansby deleted the rect-rotate branch March 8, 2021 16:37
@QuLogic QuLogic added this to the v3.5.0 milestone Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@anntzer anntzer anntzer approved these changes

@timhoffm timhoffm timhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /