tdo*_*ell 5 python visualization matplotlib polar-coordinates
我想创建一个类似于以下的极坐标图:
我找不到如何在不同角度范围内添加两个不同函数的示例。我不需要中间的径向偏移,但可能会很好。任何指针,已知的例子都将是超级的!
它看起来就像其他绘图一样matplotlib,即如果你想绘制两条曲线,你可以plt.polar多次调用。
下面是一个例子:
import numpy as np
import matplotlib.pyplot as plt
blue_thetas = np.linspace(np.pi/3, 2*np.pi/3, 100)
red_thetas = np.linspace(4*np.pi/3, 6*np.pi/3, 100)
blue_rs = np.random.uniform(4, 6, len(blue_thetas))
red_rs = np.random.uniform(3, 5, len(red_thetas))
red_curve = plt.polar(red_thetas, red_rs, c='r', label="calculated")
blue_curve = plt.polar(blue_thetas, blue_rs, c='b', label="measured")
plt.legend(loc=10)
plt.xticks(np.concatenate((red_thetas[::20], blue_thetas[::30])))
plt.title("test polar image")
plt.show()
Run Code Online (Sandbox Code Playgroud)
来源:https : //matplotlib.org/3.1.1/gallery/misc/transoffset.html#sphx-glr-gallery-misc-transoffset-py
另一个可能对您有用的 stackoverflow 帖子是:浮动径向轴