Skip to content
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

Add angle kwarg to patches.Rectangle #1405

Merged
merged 5 commits into from Nov 13, 2012

Conversation

dmcdougall
Copy link
Member

Allows rotation of a rectangle upon instantiation.

Addresses #987.
The old attempt was #1156.

@dmcdougall
Copy link
Member Author

Here's an example:

import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
r = Rectangle((0.5, 1.0), 2, 1, angle=45.0)
ax.add_patch(r)
ax.set_xlim(0, 3)
ax.set_ylim(0, 3)
ax.set_aspect('equal')
fig.savefig('rect.pdf')

@wkerzendorf
Copy link

@dmcdougall Thanks!!

@pelson
Copy link
Member

pelson commented Oct 16, 2012

Nice solution to the problem. 👍

@wkerzendorf
Copy link

When will this be merged? It's really useful to me.

@dmcdougall
Copy link
Member Author

I should add an entry to api_changes or whats_new (one of the other devs should advise me on this). It may be the case we are able to extend this for other artists, too. That should be done in a different pull request, though. This PR was only meant to satisfy the feature request in #987.

@WeatherGod
Copy link
Member

On Sunday, November 4, 2012, Damon McDougall wrote:

I should add an entry to api_changes or whats_new (one of the other devs
should advise me on this). It may be the case we are able to extend this
for other artists, too. That should be done in a different pull request,
though. This PR was only meant to satisfy the feature request in #987#987
.

It should go into "what's new" because it doesn't require any changes to
existing code.

@dmcdougall
Copy link
Member Author

Added a note in whats_new and added a test, too. Go me. When my friend Travis goes green, I consider this ready to merge. Others should review the code for any heinous style issues or hidden treasures.

@@ -20,6 +20,11 @@ revision, see the :ref:`github-stats`.
new in matplotlib-1.3
=====================

Initialize a rotated rectangle
------------------------------
Damon McDougall extended the `~matplotlib.patches.Rectangle` constructor to
Copy link
Member

Choose a reason for hiding this comment

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

should be :class:~matplotlib.patches.Rectangle``

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks.

@wkerzendorf
Copy link

@dmcdougall How's your friend Travis going?

@dmcdougall
Copy link
Member Author

@wkerzendorf He gave this PR the all-clear. I'm just waiting on some of the other devs to give feedback and merge it. I am against merging my own pull requests unless they're trivial changes.

pelson added a commit that referenced this pull request Nov 13, 2012
Add angle kwarg to patches.Rectangle
@pelson pelson merged commit 17e1cf8 into matplotlib:master Nov 13, 2012
@pelson
Copy link
Member

pelson commented Nov 13, 2012

Thanks @dmcdougall (and @wkerzendorf for the nudging 😉 ). Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants