0
我在python 2.7中使用matplotlib。我正在试图在轴外的图形区域中创建一个箭头。在图形区域绘制带锐利边缘的箭头
from matplotlib.pyplot import *
fig = figure()
ax1 = fig.add_axes([.1,.1,.6,.8])
ax1.annotate('',xy=(.8,.92),xycoords='figure fraction',xytext=(.8,.1)
arrowprops=dict(arrowstyle='->',fc='k',lw=10))
ax2 = fig.add_axes([.85,.1,.1,.8])
ax2.spines['top'].set_visible(False)
ax2.spines['bottom'].set_visible(False)
ax2.spines['left'].set_visible(False)
ax2.spines['right'].set_visible(False)
ax2.tick_params(axis='both',which='both',
top='off',right='off',left='off',bottom='off',
labeltop='off',labelright='off',labelleft='off',labelbottom='off')
ax2.patch.set_facecolor('None')
ax2.set_xlim(0,1)
ax2.set_ylim(0,1)
ax2.arrow(.5,0,0,1,fc='k',ec='k',head_width=.25,
head_length=.05,width=.15,length_includes_head=True)
show()
使用
ax1.annotate(...)
给了我一个 '模糊' 看箭头。我能弄清楚如何得到一个更好的看箭头的唯一方法是通过创建另一个轴只是为了添加箭头,使用
ax2.arrow(...)
(网站不会让我张贴图片,但复制和粘贴代码你会看到我在说什么) 还有一个更好的方式来做到这一点,虽然...