在seaborn分散:错误:序列的真值是模糊的。使用a.empty、a.bool()、a.item()、a.any()或a.all()

2024-10-01 07:45:29 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图绘制图形时,我正在寻找解决问题的方法:“序列的真值不明确。请使用a.empty、a.bool()、a.item()、a.any()或a.all() 例如,如果我删除数据“TOR”['TOR',然后只放上“TOR”(正如seaborn网站上所说的那样),那么我会得到空的图形

g = sns.FacetGrid(data_t_quali1, col='Reussie',col_order=['Reprise en main reussie','Echec de la reprise en main'],hue='Age',hue_order=[20,30,40,50,60 ],size=6,aspect=1.2,palette=sns.light_palette('navy', 4)[1:])

g.map(plt.scatter,data_t_quali1['NombreFixation'],data_t_quali1['TOR'],alpha=0.9, edgecolor='white', linewidth=2, s=300)

fig = g.fig 
fig.subplots_adjust(top=0.79, wspace=0.3)
fig.suptitle('Time to take over control (TOR) in fonction of the fixation numbers 2 minutes before the regaining control of the vehicle', fontsize=20, fontweight='bold')
g.add_legend(title='Age du conducteur')

Tags: the图形agedatamainfigordercol