Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.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
Pandas 在海生平面网格上绘制艺术家_Pandas_Seaborn - Fatal编程技术网

Pandas 在海生平面网格上绘制艺术家

Pandas 在海生平面网格上绘制艺术家,pandas,seaborn,Pandas,Seaborn,我想在facetGrid的所有面板上绘制箭头 在这个虚拟示例中,我想在所有面板上绘制相同的箭头: import numpy as np import pandas as pd import seaborn as sns import matplotlib.pylab as plt datDf=pd.DataFrame({'values':np.random.randint(0,100,100)}) datDf['group']=np.random.randint(0,5,100) g = s

我想在facetGrid的所有面板上绘制箭头

在这个虚拟示例中,我想在所有面板上绘制相同的箭头:

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pylab as plt


datDf=pd.DataFrame({'values':np.random.randint(0,100,100)})
datDf['group']=np.random.randint(0,5,100)
g = sns.FacetGrid(datDf, col="group",
                  col_wrap=3,
                  size=4.5,
                  sharex=True, sharey=True, despine=False)
g.map(plt.plot,'values')

for ax in g.axes:
    arrow=plt.arrow(0,0,50,50,width=5,
            length_includes_head=True,
            head_width=5*2,
            color='gray')
    ax.add_artist(arrow)
我收到这个错误:

ValueError:无法重置轴。您可能试图在多个不受支持的轴上重复使用艺术家


在facetGrids上绘制艺术家的正确方法是什么?

您可以使用
ax.arrow
而不是
plt.arrow
在轴上绘制箭头

这应该起作用:

for ax in g.axes:
    ax.arrow(0,0,50,50,width=5,
            length_includes_head=True,
            head_width=5*2,
            color='gray')