我有一个包含三列的数据框。我想为每个网络设置一个框图,按轴的“特征”和 CV 折叠进行分组(参见示例图像)。Features, CV-fold, Accuracy, Network
df = pd.read_csv(path)
df['Features'] = df["Features"].astype('category')
ordered_features = sorted(df.Network.value_counts().index)
df = df.loc[df['Accuracy'] > 0.1]
df.Accuracy = df.Accuracy*100
#sns.color_palette("husl", len(df['CV-fold'].value_counts().index))
#sns.set_palette('husl', len(df['CV-fold'].value_counts().index))
g = sns.FacetGrid(df, row="Network", row_order=ordered_features,
height=3, aspect=3, legend_out=True, despine=False)
g.map(sns.boxplot, x="CV-fold", y="Accuracy", hue="Features", data=df, palette='muted').add_legend()
g.set_axis_labels("", "Accuracy (%)")
因为我有8个不同的网络,所以我不想将它们全部放在一列或一行中,而是格式化为网格(例如2x4)。此外,即使未启用,x 轴也仅在最底部的图形中标记。sharex
我该怎么做?
米脂
相关分类