我如何使用seaborn而不改变matplotlib默认值



我正在尝试使用seaborn,因为它的distplot功能。但我更喜欢默认的matplotlib设置。当我导入seaborn时,它会自动改变我的图形的外观。

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

Version 0.8(2017年7月)改变了此行为。从https://seaborn.pydata.org/whatsnew.html # v0 - 8 - 0 - 7 - 2017:

默认(seaborn)样式在seaborn为时不再应用进口的。现在需要显式调用set()或一个或多个set_style(), set_context()和set_palette()。相应的,seaborn。Apionly模块已弃用。

对于旧版本,像这样导入seaborn:

import seaborn.apionly as sns

,然后你应该能够使用sns.distplot,但保持默认的matplotlib样式+你的个人rc配置。

根据文档reset_orig恢复所有RC参数到原始设置:

import seaborn as sns
# reset RC params to original
sns.reset_orig()

最新更新