matplotlib - 如何在matplotlib中使用pyplot.arrow或patchs.Arrow?

标签 matplotlib

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

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画一条线但没有箭头。

最佳答案

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

关于matplotlib - 如何在matplotlib中使用pyplot.arrow或patchs.Arrow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7947532/

相关文章:

python - 垂直线不出现在 matplotlib 图中

numpy - mplot3d 教程示例未正常运行

python-3.x - Seaborn虚线在图例中不是虚线

python - 如何使用 pandas 和 matplotlib 按月创建昼夜剖面图?

python - 条形图不尊重 matplotlib 中图例文本的顺序

python - Matplotlib:混合导出为 pdf 和 png

python - 如何在 matplotlib 图形上循环显示颜色和线型?

python - 如何将 ipywidget slider 的默认位置更改为 matplotlib 图的一侧?

Python3 ginput 警告 : Using default event loop

python - 在 matplotlib 中,为什么用细线绘图会更快?