如何在不更改matplotlib默认值的情况下使用seaborn? [英] How can I use seaborn without changing the matplotlib defaults?

查看:131
本文介绍了如何在不更改matplotlib默认值的情况下使用seaborn?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于其distplot功能,我正在尝试使用seaborn.但是我更喜欢默认的matplotlib设置.导入seaborn时,它会自动更改图形的外观.

I am trying to use seaborn, because of its distplot function. But I prefer the default matplotlib settings. When I import seaborn, it changes automatically the appearance of my figure.

如何在不改变情节外观的情况下使用seaborn函数?

How can I use seaborn functions without changing the look of the plots?

推荐答案

版本0.8(2017年7月)更改了此行为.来自 https://seaborn.pydata.org/whatsnew.html :

Version 0.8 (july 2017) changed this behaviour. From https://seaborn.pydata.org/whatsnew.html:

当seaborn为 进口的.现在必须显式调用set()或一个或多个 set_style(),set_context()和set_palette()的集合.相应地, seaborn.apionly模块已被弃用.

The default (seaborn) style is no longer applied when seaborn is imported. It is now necessary to explicitly call set() or one or more of set_style(), set_context(), and set_palette(). Correspondingly, the seaborn.apionly module has been deprecated.

对于较旧的版本,请按以下步骤导入seaborn:

For older versions, Import seaborn like this:

import seaborn.apionly as sns

,那么您应该能够使用sns.distplot,但保持默认的matplotlib样式+您的个人rc配置.

and then you should be able to use sns.distplot but maintain the default matplotlib styling + your personal rc configuration.

这篇关于如何在不更改matplotlib默认值的情况下使用seaborn?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆