平滑matplotlib和seaborn的图

问题描述 投票:0回答:2

我正在尝试以一种很好的方式显示我的数据,如在Seaborn文档中所见:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9zZWFib3JuLnB5ZGF0YS5vcmcvX2ltYWdlcy9lcnJvcmJhbmRfbGluZXBsb3RzLnBuZyJ9> alt =”文字“>

我不太确定该如何进行。我设法获得了点的值及其各自的标准偏差,但是当我只想显示一种趋势时,它看起来很分散:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLmltZ3VyLmNvbS81cGNHNGtutunnBuZyJ9” alt =“文本”>

[我研究了herethere试图应用所提出的解决方案,但我无法使其工作。

我在这里玩:

Final_array =         Mean       Std
0   0.739269  0.157892
1   0.807382  0.160464
2   0.800024  0.137239
3   0.825854  0.132472
4   0.864854  0.070544
..       ...       ...
95  0.797202  0.101961
96  0.747578  0.143394
97  0.751472  0.158651
98  0.587009  0.198987
99  0.728447  0.104601

sns.set(style="darkgrid", palette="muted", color_codes=True)
fig, ax = plt.subplots(figsize=(7,5))
y_pos = np.arange(Final_array.shape[0])
ax.errorbar(y_pos, Final_array[:,0], yerr=Final_array[:,1], elinewidth=0.5)
plt.show()

有人有想法吗?我是使用地块的初学者。可以平滑吗?并获得与seaborn图片一样的漂亮叠加层,而不是误差线?

这些可能是愚蠢的问题。

亲切的问候,

我正在尝试以一种很好的方式显示我的数据,就像在Seaborn文档中看到的那样:我不太确定该如何进行。我设法得到了点的值及其各自的标准偏差...

python matplotlib seaborn smoothing
2个回答
2
投票

您可以使用fillbetween平滑上,下曲线。选择较高的sigma将提供更多的平滑度。


0
投票

谢谢您的帮助!我设法生成了想要的图形!

© www.soinside.com 2019 - 2024. All rights reserved.