当愿意在matplotlib
中使用自定义箭头样式时,可以使用本答案中解释的方法。但是,当指定shrinkA
或shrinkB
时,仍然存在问题。
我想到了一种方法来计算这些值使用matplotlib
函数,但没有成功,做:
import matplotlib.patches as patches
orig = (1.1,2.)
target = (1.1,3.)
shrinkA = 10. # given in points
shrinkB = 0.
b = patches.ConnectionStyle('arc')
path = b.connect( orig, target )
path = b._shrink( path, shrinkA, shrinkB )
但是当我这样做时,path
没有发生任何事情…有什么建议吗?
这种方法是非常正确的,似乎shrinkA
和shrinkB
应该以0.
和1.
之间的比率值给出:
orig = (1.1,2.)
target = (1.1,7.)
shrinkA = 0.1 # given in points
shrinkB = 0.1
b = patches.ConnectionStyle('Arc')
path = b.connect( orig, target )
path = b._shrink( path, shrinkA, shrinkB )
获取orig
和target
的新值:
neworig, newtarget = path.vertices