-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix rectangular patches to be properly transformed on polar axes #8539
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
Conversation
This PR looks good. After a little more review happens, would you mind squashing these commits down to a single commit? If not we can take care of it when it's merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks really good, thanks for the PR!
The test needs a couple of changes, and the test should also be moved to an existing test file (probably lib/matplotlib/tests/test_patches.py
)
|
||
@image_comparison(baseline_images=['polar_proj'], extensions=['png']) | ||
def test_adding_rectangle_patch(): | ||
fig = plt.figure(figsize=(640/80, 640/80), dpi=80) |
There was a problem hiding this 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 you need to specify the figsize or dpi, just plt.figure()
should be fine.
# add quadrant as example | ||
ax.add_patch( | ||
patches.Rectangle( | ||
(0, 1), width=math.pi * 0.5, height=0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent with the rest of the tests, this should use numpy and be np.pi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the input. Will fix this as soon as I get home today from work.
I'm not sure we need a separate file for this either; it should be able to fit in |
Oh, I see @dstansby suggested |
@phobson Could you please kindly give me some pointers on how to squash the commits together? I don't normally use git, and have not found anything useful on the internet :) |
@dstansby can you take another look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me, thanks for the PR!
This reverts commit 3e2e31e, reversing changes made to 8149536. This has some un-intended consequences (see matplotlib#9261). This exposes a bigger issue about drawing on to non-linear axes which is if we transform only the vertices or the full paths. Which the user wants is dependent on context so we need to expose this at the user API in a nice way, but is a bigger change than we can accommodate for 2.1. Reverting this change to return to the (slightly) broken state which has been the satus-quo 7 years.
Revert "Merge pull request #8539 from Tuan333/tuan"
PR Summary
Rectangle patch not transformed correctly in polar plot #8521. The bug fix tries to specify the number of _interpolation_steps for Path._unit_rectangle in the _AxesBase.add_patch() function. It appears that 'polar' transforms require more than the default _interpolation_steps == 1.
More test cases can be generated upon request
#8521
PR Checklist