Matplotlib箭头两侧带箭头的情节

时间:2014-04-08 14:43:26

标签: python matplotlib

是否有可能在matplotlib中生成箭头两侧带箭头的箭袋图,如果是这样的话(没有过度绘制两组箭头的明显解决方法)。

1 个答案:

答案 0 :(得分:0)

一种解决方法是创建两个指向相反方向的箭头。

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d', proj_type = 'ortho')
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
ax.set_zlim(-2, 2)

v_location = [0, 0, 0]
v = [1, 1, 0]

v_temp = np.concatenate([np.array(v_location), np.array(v)])
v_q = ax.quiver(*v_temp, color='black', arrow_length_ratio=0.2)

v_temp = np.concatenate([np.array(v_location), -np.array(v)])
v_q = ax.quiver(*v_temp, color='black', arrow_length_ratio=0.2)

enter image description here