本文整理汇总了Python中mpl_toolkits.axes_grid.axislines.SubplotZero.quiver方法的典型用法代码示例。如果您正苦于以下问题:Python SubplotZero.quiver方法的具体用法?Python SubplotZero.quiver怎么用?Python SubplotZero.quiver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpl_toolkits.axes_grid.axislines.SubplotZero
的用法示例。
在下文中一共展示了SubplotZero.quiver方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: zip
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import quiver [as 别名]
h = orig + heading # normalized heading
x = orig + orientation # normalized orientation
g = orig + acceleration
print h,x,g
soa = np.array([h,x,g]) # vectors
print soa
X,Y,U,V = zip(*soa) # convert to turples of U and V components
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
colors = ('r','g','b')
qv = ax.quiver(X,Y,U,V,color=colors,angles='xy',scale_units='xy',scale=1)
labels = ('heading: {} deg'.format(hdeg), 'Orientation, drift: {} deg'.format(drift), '{} g at {} deg'.format(aforce,adeg))
pos = ('N','E','S')
for x,y,l,c,p in zip(U,V,labels,colors,pos):
plt.quiverkey(qv,x,y,0,l,color=c,coordinates='data',labelpos=p)
ax.set_xlim([-2,2])
ax.set_ylim([-2,2])
# show cartisian axis
# for direction in ["xzero", "yzero"]:
# ax.axis[direction].set_visible(True)
# turn off side axis
for direction in ["left", "right", "bottom", "top"]:
示例2: SubplotZero
# 需要导入模块: from mpl_toolkits.axes_grid.axislines import SubplotZero [as 别名]
# 或者: from mpl_toolkits.axes_grid.axislines.SubplotZero import quiver [as 别名]
from mpl_toolkits.axes_grid.axislines import SubplotZero
from matplotlib import colors
roll = 15
pitch = 5
orig = [0, 0]
X, Y = (0, 0) # origin
U = roll
V = pitch
fig = plt.figure(1)
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
qv = ax.quiver(X, Y, U, V, color="y", angles="xy", scale_units="xy", scale=1)
ax.set_xlim([-45, 45])
ax.set_ylim([-45, 45])
# show cartisian axis
for direction in ["xzero", "yzero"]:
ax.axis[direction].set_visible(True)
# turn off side axis
# for direction in ["left", "right", "bottom", "top"]:
# ax.axis[direction].set_visible(False)
plt.draw()
plt.show()