Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 如何在其中一个子图中绘制箭头?_Python 3.x_Matplotlib - Fatal编程技术网

Python 3.x 如何在其中一个子图中绘制箭头?

Python 3.x 如何在其中一个子图中绘制箭头?,python-3.x,matplotlib,Python 3.x,Matplotlib,请问如何控制箭头应该画到哪个子地块?现在是第二个,如何分配给第一个 import matplotlib.pyplot as plt import seaborn as sns import matplotlib.patches as patches fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True, sharey=True, figsize=(10,3)) ax1.set_xlim(0, 0.05) ax1.set_ylim(0, 1500

请问如何控制箭头应该画到哪个子地块?现在是第二个,如何分配给第一个

import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.patches as patches

fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True, sharey=True, figsize=(10,3))
ax1.set_xlim(0, 0.05)
ax1.set_ylim(0, 1500)

style="Simple,tail_width=0.5,head_width=4,head_length=8"
kw = dict(arrowstyle=style, color='black')
a3 = patches.FancyArrowPatch((0, 0), (0.01, 500),connectionstyle="arc3,rad=-0.3", **kw)
for a in [a3]:
    plt.gca().add_patch(a)

plt.show()

将面片直接添加到轴上如何:

# for a in [a3]:
#    plt.gca().add_patch(a)
ax1.add_patch(a3)
输出:


(1)
cfg
从未定义。(2) 这会以什么方式失败?你有错误吗?请发布一个最小的,完整的,可验证的例子。对不起,我编辑了这个问题。