【发布时间】:2021-08-28 11:24:15
【问题描述】:
我的数据看起来像:
engages_telehealth knockout_tox pcc variable value
0 True True True health 135.50
1 True True True admitted 3443.25
2 True True False health 136.50
3 True True False admitted 3444.45
4 True False True health 115.50
5 True False True admitted 3640.80
6 True False False health 117.75
7 True False False admitted 3615.60
8 False True True health 137.00
9 False True True admitted 3314.90
10 False True False health 136.00
11 False True False admitted 3320.40
12 False False True health 115.00
13 False False True admitted 3334.25
14 False False False health 115.00
15 False False False admitted 3363.25
我想制作一个类似于下图的层次聚类箱线图,这是描述生物学中多种条件的某种标准方式。
分层图的其他 SO 问题(this 或 this)可能有三层,但这些是集群而不是独立条件,我的条件是布尔而不是数字。
我试过猫图:
print(df_graph)
fig = plt.figure()
ax=fig.add_subplot(111)
sns.catplot(data=df_graph,x='variable',y='value',col=[ck1,ck2], kind='bar', ax=ax)
plt.show()
但是,col 参数只接受一个字符串,我不想创建一个FacetGrid,因为我正在准备的文档中没有空间。
【问题讨论】:
标签: python matplotlib seaborn data-visualization graphing