Matplotlib:箭头

日期2007-12-06(最后修改),2007-12-06(创建)

一些关于如何使用 Arrow 函数绘制箭头的示例代码。

在 [3] 中
from matplotlib.pyplot import *
from numpy import *

x = arange(10)
y = x

# Plot junk and then a filled region
plot(x, y)

# Now lets make an arrow object
arr = Arrow(2, 2, 1, 1, edgecolor='white')

# Get the subplot that we are currently working on
ax = gca()

# Now add the arrow
ax.add_patch(arr)

# We should be able to make modifications to the arrow.
# Lets make it green.
arr.set_facecolor('g')

章节作者:jesrl

附件