【发布时间】:2021-11-04 04:31:50
【问题描述】:
我正在努力寻找一种解决方案来规范化 pandas 数据帧的分组 seaborn 点图通过对照组
为了更清楚,这是我的 seaborn 情节的结果 , 由于这段代码:
sns.pointplot(x='CELL TYPE',y='VELOCITY', hue = 'condition',ci=99 ,data=df_condition_cut1,ax = ax,order=['FRONT', 'MIDDLE', 'BACK'],
ordered=True)
我想要获得的是这种图,但通过每个条件下的 FRONT 单元类型的平均值进行归一化。
请在此处找到带有简化图的重要采样数据集
from matplotlib import pyplot as plt
import seaborn as sns
import pandas as pd
df_cells = pd.DataFrame(data = {'VELOCITY':[1.4,1.6,1.3,1.1,0.8,0.7,2.3,1.8,1.7,1.5,1.6,1.7],
'condition':['A1','A1','A1','A1','A1','A1','A2','A2','A2','A2','A2','A2'],
'CELL TYPE':['FRONT','FRONT','MIDDLE','MIDDLE','BACK','BACK','FRONT','FRONT','MIDDLE','MIDDLE','BACK','BACK']})
print(df_cells)
fig, ax = plt.subplots(figsize=(25,12))
sns.pointplot(x='CELL TYPE',y='VELOCITY', hue = 'condition',ci=99 ,data=df_cells,ax = ax,order=['FRONT', 'MIDDLE', 'BACK'],
ordered=True)
你对如何获得这个有什么建议吗?
谢谢 伊曼纽尔
【问题讨论】:
-
请问,您能否提供大量数据样本?
-
亲爱的@Zephyr,我已经用采样数据更新了我的帖子,并进行了一些剪裁以绘制它
标签: python pandas plot seaborn