【发布时间】:2021-11-16 21:07:51
【问题描述】:
要使用 seaborn 获得 ECDF 图,应执行以下操作:
sns.ecdfplot(data=myData, x='x', ax=axs, hue='mySeries')
这将为mySeries 中的myData 中的每个系列提供ECDF 图。
现在,我想为每个系列使用标记。我尝试使用与 sns.lineplot 相同的逻辑,如下所示:
sns.lineplot(data=myData,x='x',y='y',ax=axs,hue='mySeries',markers=True, style='mySeries',)
但不幸的是,markers 或 style 的关键字不适用于 sns.ecdf 图。我正在使用 seaborn 0.11.2。
对于一个可重现的例子,可以使用企鹅数据集:
import seaborn as sns
penguins = sns.load_dataset('penguins')
sns.ecdfplot(data=penguins, x="bill_length_mm", hue="species")
【问题讨论】:
-
嗨@JohanC,所以我想做的是在我的ECDF图中使用标记而不是平线。但同样,即使曲线看起来不可读(这当然取决于曲线;在我的情况下是完全可能的),怎么能做到呢?我有色盲的同事,使用标记会有所帮助......
-
除了@JohanC 的回答,您可以考虑直接使用 matplotlib 创建自己的 ecdf 图,这也允许您使用
marker、linestyle和其他绘图参数。 Plotting all of your data: Empirical cumulative distribution function
标签: python seaborn markers ecdf