问题描述
import numpy as np
import pandas as pd
import seaborn as sns
df = pd.DataFrame({'att1': np.random.choice([1,3,5,8,10,30,50,100],500),'att2': np.random.choice(['a','b','c','d','e','f','g'],'att3': np.random.choice(['t1','t2','t3','t4'],'type': np.random.choice(['positive','negative'],'value': np.random.normal(0,20,500)})
我想绘制att3与值的箱线图,并能够按正负类型彼此相邻的att2(以不同颜色显示)分组。 att2为正-负,并且必须彼此相邻显示 目前,我只能按att2分组,而不能将不同类型的att2放在一起。 我正在使用seaborn Boxplots完成此操作
ax = sns.Boxplot(x="att3",hue="att2",y="value",data=df)
我得到这样的东西:
有人可以告诉我我们如何实现这一目标吗?预先感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)