9

極座標で矢筒プロットを作成するにはどうすればよいですか?rとシータに関するデータがあります。私はもう試した:

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方向のデータのベクトルです。

4

1 に答える 1

8

矢筒は変換を行わないようです。(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))

グラフ

于 2012-12-12T19:07:21.223 に答える