matplotlib 极坐标 画箭头 显示航向

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure(figsize=(5, 5))
ax = fig.add_subplot(111, projection='polar')

theta = np.linspace(0,2 * np.pi, 20, endpoint=False)
r = np.linspace(0.2, 1, 5)

x, y = np.meshgrid(60, r)
u = np.cos(x) * y
v = np.sin(x) * y
ang = 30 *np.pi/180
ax.quiver(ang, 0.9, np.cos(ang), np.sin(ang), color='r')
ax.plot([0,ang], [0,1],'-',color='r')

ang = -60 *np.pi/180
ax.quiver(ang, 0.9, np.cos(ang), np.sin(ang), color='blue')
ax.plot([0,ang], [0,1],'-',color='blue')
plt.show()

matplotlib 极坐标 画箭头 显示航向_第1张图片ax.quiver(0,0,theta[0],rho,angles='xy',scale_units='xy',scale=1,color='blue')

你可能感兴趣的:(matplotlib)