Skip to content

Allow non-default scales on polar axes #24825

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
merged 7 commits into from
Jan 12, 2023
Merged

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Dec 27, 2022

PR Summary

After a long excursion down the rabbit hole of polar Axes transforms, I have emerged to working log-polar axes! Unsurprisingly the fix was trivial - see 82d5c5f. While I was at it the other commits add some more commenting and tidy up some code. Please leave critical reviews and suggestions, would be good to address them while I still have all this context in my head!

polar_log

Based on top of #24763

Fixes #24383
Fixes #12803
Fixes probaby #7751
Fixes probably #5527

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

t *= self._axis.get_theta_direction()
t += self._axis.get_theta_offset()
theta *= self._axis.get_theta_direction()
theta += self._axis.get_theta_offset()
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to add a test that uses these lines?

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like _apply_theta_transforms=True case is not used internally, but as a backwards compatability wrapper for users who used PolarTransform before its behaviour was changed. I think adding a meaninful test would be tricky here.

@oscargus
Copy link
Member

oscargus commented Dec 28, 2022

Also, can you please add a test for #12803? Or is it "obvious" that this is tested by the existing one?

Oh, and possibly the other ones as well. (It seems like "Probably fixes" is interpreted as "fixes", so those will be closed upon merging this with the current statement.)

In general, I think this all looks good, but since I do not really know the area well enough I can only comment on details. (The previous PR was small enough for me to understand...)

@dstansby
Copy link
Member Author

Also, can you please add a test for #12803? Or is it "obvious" that this is tested by the existing one?

I think it's obvious, in that it's the same bug that was causing both #12803 #24383 (that I've fixed and added a test to).

Oh, and possibly the other ones as well. (It seems like "Probably fixes" is interpreted as "fixes", so those will be closed upon merging this with the current statement.)

I've updated the comment so these aren't closed if/when this PR is merged. After a bit more investigation I think this fixes them a bit, but not fully.

Copy link
Member

@oscargus oscargus left a comment

Choose a reason for hiding this comment

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

Looks good as far as I can tell!

Unsure about 3.7 or 3.8, so I'll try to get some clarity during the dev-call tonight and then merge accordingly.

ax = fig.add_subplot(polar=True)

ax.set_yscale('log')
ax.set_ylim(1, 1000)
Copy link
Member

Choose a reason for hiding this comment

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

For clarity, I would use set_rscale and set_rlim.

@tacaswell tacaswell added this to the v3.7.0 milestone Jan 12, 2023
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
@oscargus oscargus merged commit ba03951 into matplotlib:main Jan 12, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 12, 2023
@dstansby dstansby deleted the polar-scales branch January 12, 2023 21:19
oscargus added a commit that referenced this pull request Jan 12, 2023
…825-on-v3.7.x

Backport PR #24825 on branch v3.7.x (Allow non-default scales on polar axes)
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

log scale and polar broken pcolormesh in log polar coordinates
5 participants