我seaborn和Matplotlib情节看起来是一样的?

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

最近人们一直告诉我,seaborn是最好的数据可视化包在Python,所以我决定尝试一下。不过,我看情节完全相同我matplotlib阴谋..

我使用PyCharm,Python的3.6。

这里是我的超级简单的代码来测试两个:

x = [1, 2, 3, 4, 5]
y = [11, 12, 13, 14, 15]

plt.plot(x, y)
plt.show()

sns.lineplot(x, y)
plt.show()

他们都看起来像:

enter image description here

通常情况下,seaborn地块应该有leasthave有格网的蓝色背景。为什么煤矿不能正常工作?

matplotlib seaborn
1个回答
0
投票

Seaborn是matplotlib的一个推广,从而简化某些任务。即常产生一曲线图与seaborn需要,将采取直接与matplotlib绘制的代码线的数量只有30%至50%。但是,每一个情节seaborn不一定是matplotlib阴谋。

关于风格,seaborn对设置样式参数一些捷径。那些进行了详细的解释Aestetics tutorial

总之,你可以使用

seaborn.set()

获得“darkgrid”的主题;您可以使用

seaborn.reset_defaults()

在参数重置回matplotlib默认值。

基本上[*]同样可以与matplotlib通过实现

plt.style.use("seaborn-darkgrid")

plt.style.use("default")

对于这种阅读matplotlib customizing tutorial


[*] There are small differences, because seaborn.set also sets other parameters like defaults of figure size etc.
© www.soinside.com 2019 - 2024. All rights reserved.