Skip to content

pcolormesh in log polar coordinates #12803

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

Closed
yoichi-kazama opened this issue Nov 13, 2018 · 3 comments · Fixed by #24825
Closed

pcolormesh in log polar coordinates #12803

yoichi-kazama opened this issue Nov 13, 2018 · 3 comments · Fixed by #24825
Milestone

Comments

@yoichi-kazama
Copy link

Bug report

Bug summary

radius range setting does not work for pcolormesh() in log polar coodinates.

Code for reproduction

%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

r = np.geomspace(1, 100, num=10)
th = np.linspace(0, 360, num=50)
th = np.radians(th)
v = np.random.rand(len(r), len(th))

ax = plt.subplot(1, 1, 1, projection='polar')
ax.set_rlim(1, 100)
ax.set_rscale('log')
plt.pcolormesh(th, r, v)

Actual outcome

pcolormesh_polar

Expected outcome

I think the pixels should spread to the outer edge of the circle, and no warnings should be shown.

Matplotlib version

  • Operating system: Windows 8.1
  • Matplotlib version: 2.2.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.6.6
  • Jupyter version (if applicable): Jupyterlab 0.34.1
  • Other libraries:

Python, jupyterlab numpy and matplotlib were installed with conda.

@timhoffm
Copy link
Member

There's more going wrong: The radial tick labels are missing:

%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

r = np.geomspace(1, 100, num=10)
th = np.linspace(0, 360, num=50)
th = np.radians(th)
v = np.random.rand(len(r), len(th))

fig, (ax1, ax2) = plt.subplots(1, 2, subplot_kw={'projection' :'polar'}, figsize=(10, 5))
ax1.set_rlim(1, 100)
ax1.pcolormesh(th, r, v)

ax2.set_rlim(1, 100)
ax2.set_rscale('log')
ax2.pcolormesh(th, r, v)

grafik

@timhoffm
Copy link
Member

Here's a diff of transData of the two versions.

grafik

I suspect that the issue is the x1=5.0 instead of x1=10.0 in the very last Bbox. Can somebody with more transform experience please check this.

@dstansby
Copy link
Member

I suspect this is the same bug as #24383 - I think it will be easier to fix #24383 first (there's an even simpler example of radial log scale that doesn't work there), then come back to this issue and see if it's fixed as a side effect.

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

Successfully merging a pull request may close this issue.

5 participants