set_rgrids半径对python极坐标图的奇怪影响

时间:2018-08-21 21:39:26

标签: python plot polar-coordinates

有人知道为什么,在下面的代码中,如果我指定了r网格半径(使用set_rgrids),那么以最小的半径绘制了最内部的圆?但是,如果我只注释掉set_rgrids线,则可以正确地以r = 1绘制最内部的圆?

import numpy as np
import matplotlib.pyplot as plt

theta = np.arange(0, 2, 1./100)*np.pi
rs = [1+0*theta, 2+0*theta, 3+0*theta, 4+0*theta];

ax = plt.subplot(111,polar=True)

#if the following line is commented out the problem disappears!
ax.set_rgrids([1, 2, 3])

ax.plot(theta, rs[0])

for i in range(len(rs)-1):
    ax.plot(theta, rs[i+1])

plt.show()

0 个答案:

没有答案