【发布时间】:2016-04-23 15:42:43
【问题描述】:
我无法让 seaborn 色调按价值着色。我的数据在 pandas df 中,我正在使用条形图。
sns.barplot(x = plot_data['gene'], y = plot_data['freq'],
hue=plot_data["type"],palette={"type1":"red", "type2":"blue"}, ax=ax2)
我对出现在某些地方的灰色条感到困惑。我希望只有红色和蓝色条,我确信这是数据中仅有的两种类型。
【问题讨论】:
-
请检查数据并且您没有使用嵌套数据:stanford.edu/~mwaskom/software/seaborn/generated/…
-
我不认为我的数据是嵌套的 - 每个数据点都在一行中,“类型”列确定类别。
-
只有三行数据你能做到这一点吗?并向我们展示数据?
-
没有样本数据就无法重现。