gpt4 book ai didi

matplotlib - 使用中位数代替均值的 Seaborn 线图

转载 作者:行者123 更新时间:2023-12-01 07:23:31 27 4
gpt4 key购买 nike

我正在使用 seaborn.lineplot()创建一个像这样的线图(一条代表平均值的线,被一个代表标准的带包围):

sns.lineplot(x="trial", y="rvalues", hue="subject", err_style="band", ci='sd', data=df)

enter image description here

我唯一的问题是,由于我的数据不是高斯数据,我更关心 中位数 而不是 平均值 .如何在 Seaborn 中做到这一点?

或者有没有类似的工具?我知道我可以在 matplotlib 中从头开始做,但这需要大量的工作才能使它变得如此出色。

最佳答案

estimator应该是 Pandas 方法。

使用 estimator=np.median而不是 estimator="median" .

sns.lineplot(x="trial", y="rvalues", hue="subject", err_style="band",
ci='sd',
estimator=np.median,
data=df)

关于matplotlib - 使用中位数代替均值的 Seaborn 线图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52525476/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com