如何在极坐标中绘制颤动图?我有 r 和 theta 方面的数据。我试过了:
import numpy as np
radii = np.linspace(0.5,1,10)
thetas = np.linspace(0,2*np.pi,20)
theta, r = np.meshgrid(thetas, radii)
f = plt.figure()
ax = f.add_subplot(111, polar=True)
ax.quiver(theta, r, dr, dt)
其中 dr 和 dt 是 r 和 theta 方向上的数据向量。
看起来 quiver 没有为你做转换。您需要手动进行 (r,t) -> (x,y) 转换:
radii = np.linspace(0.5,1,10)
thetas = np.linspace(0,2*np.pi,20)
theta, r = np.meshgrid(thetas, radii)
dr = 1
dt = 1
f = plt.figure()
ax = f.add_subplot(111, polar=True)
ax.quiver(theta, r, dr * cos(theta) - dt * sin (theta), dr * sin(theta) + dt * cos(theta))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)