我正在做多个变量随时间变化的模拟。有时,绘制变量而不是相对于时间轴(x(t) 与 t)而是相对于彼此(x(t) 与 y(t))很有用。在这些情况下,如果我可以添加某种箭头(覆盖在曲线上)来指示时间流向,那就太好了。
我的问题:有没有人知道一个简单或内置的方法来做到这一点,或者我应该自己破解一些东西?
我正在做多个变量随时间变化的模拟。有时,绘制变量而不是相对于时间轴(x(t) 与 t)而是相对于彼此(x(t) 与 y(t))很有用。在这些情况下,如果我可以添加某种箭头(覆盖在曲线上)来指示时间流向,那就太好了。
我的问题:有没有人知道一个简单或内置的方法来做到这一点,或者我应该自己破解一些东西?
试试这个(来自 matplotlib 食谱http://www.scipy.org/Cookbook/Matplotlib/Arrows):
from pylab import *
from numarray 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')