我正在尝试使用 seaborn,因为它具有 distplot 功能。但我更喜欢默认的 matplotlib 设置。当我导入 seaborn 时,它会自动改变我的身材的外观。
如何在不改变绘图外观的情况下使用 seaborn 函数?
我正在尝试使用 seaborn,因为它具有 distplot 功能。但我更喜欢默认的 matplotlib 设置。当我导入 seaborn 时,它会自动改变我的身材的外观。
如何在不改变绘图外观的情况下使用 seaborn 函数?
0.8 版(2017 年 7 月)改变了这种行为。来自https://seaborn.pydata.org/whatsnew.html#v0-8-0-july-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()