在matplotlib中绘制无网格极坐标图

13 投票
1 回答
12999 浏览
提问于 2025-04-16 19:46

有没有办法在matplotlib中关闭极坐标图的网格线?我试过用 matplotlib.pyplot.rgrids([], []),但是没效果。

1 个回答

23

从你的 axes 实例中,调用 grid(False)

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
ax.grid(False)

r = np.arange(0,1,0.001)
theta = 2*2*np.pi*r

ax.plot(theta,r)
plt.show()

撰写回答