本文介绍了如何在matplotlib中使用pyplot.arrow或patchs.Arrow?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想使用箭头/箭头功能之一绘制箭头而不是轴线,如何显示线/箭头?下面的例子:

If I wanted to draw arrows instead of axis lines using one of the arrow/Arrow functions, how do I get the line/arrowhead to show up? Example below:

import matplotlib.pyplot as plt
import matplotlib.patches as pts

plt.ion()
ax = plt.axes()
ax.set(xlim=[0,1],ylim=[0,1],autoscale_on=False,clip_on=False)
ax.set(frame_on=False,xticks=[],yticks=[])
pts.Arrow(0,0,1,0,width=0.05)
plt.arrow(0,0,0,1,shape='right',lw=3,fill=True)
ax.text(1,0,'functionalization',
        verticalalignment='top',
        horizontalalignment='center')
ax.text(0,1,'void space/structure')
plt.draw()

pts.Arrow不画任何东西,而plt.arrow画一条线但没有箭头.

pts.Arrow draws nothing, and plt.arrow draws a line but no arrowhead.

推荐答案

plt.arrow(0,0,0,1, shape='full', lw=3, length_includes_head=True, head_width=.01)

这篇关于如何在matplotlib中使用pyplot.arrow或patchs.Arrow?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 23:31