Python matplotlib极坐标图轴标签位置

Python matplotlib极坐标图轴标签位置,python,matplotlib,Python,Matplotlib,我玩极坐标图已经有一段时间了,但我不知道如何将轴标签自动放置在正确的位置 import numpy as np import matplotlib.pyplot as plt fig = plt.figure(figsize=[5, 5]) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], projection="polar") r = np.random.normal(loc=50, scale=5, size=50) theta = np.deg2rad(n

我玩极坐标图已经有一段时间了,但我不知道如何将轴标签自动放置在正确的位置

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure(figsize=[5, 5])
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], projection="polar")

r = np.random.normal(loc=50, scale=5, size=50)
theta = np.deg2rad(np.random.normal(loc=190, scale=2, size=50))

# Plot
ax.scatter(theta, r)

# Adjust limits
ax.set_rorigin(0)
ax.set_thetamin(180)
ax.set_thetamax(200)
ax.set_rmin(40)
ax.set_rmax(60)

# Labels
ax.set_xlabel("r")
ax.set_ylabel(r"$\theta$")

plt.show()
这就产生了这样一个图:

如您所见,“r”标签不会出现在刻度标签所在的顶轴上,对于其他θ范围,我也有类似的问题。是否有办法始终使轴标签与带有记号标签的轴一起显示?或者半径的刻度标签是否始终位于底部轴

谢谢