Matplotlib: set_rscale('log') not working with polar plot

Viewed 17

I am trying to create a polar plot with log scale on radius axis basing on this matplotlib example.

import numpy as np
import matplotlib.pyplot as plt

r = np.arange(1, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r)
ax.set_rlim((1,2))
ax.set_rscale('log')
ax.grid(True)
plt.show()

but I am getting an error with a dozen of lines:

posx and posy should be finite values
...

According to this question I should use set_rlim after set_rscale, but this swapping results in the same errors.

My matplolib version is 3.3.4.

0 Answers
Related