在 Matplotlib 中绘制图外的箭头 [英] Draw arrow outside plot in Matplotlib

查看:32
本文介绍了在 Matplotlib 中绘制图外的箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下网格图,并想绘制一个箭头(使用 MS Paint 显示为蓝色).我怎样才能通过 matplotlib 做到这一点?我不知道要执行什么命令.

I have the following gridded plot, and would like to draw an arrow (shown in blue using MS paint). How can I do it through matplotlib? I do not know of any command to do it.

推荐答案

import matplotlib.pyplot as plt

fg = plt.figure(1);
fg.clf();
ax = fg.add_subplot(1,1,1)
ax.annotate('', xy=(0, -0.1), xycoords='axes fraction', xytext=(1, -0.1), 
            arrowprops=dict(arrowstyle="<->", color='b'))
ax.grid(True)
fg.canvas.draw()

给出

这篇关于在 Matplotlib 中绘制图外的箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆