方法 seaborn.set_theme() 不起作用 [英] The method seaborn.set_theme() does not work

查看:57
本文介绍了方法 seaborn.set_theme() 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 jupyter notebook 中,我运行

In a jupyter notebook, I run

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import scipy.stats as stat 

然后在另一个单元格中,我运行 sns.set_theme(),然后出现以下错误

and then in another cell, I run sns.set_theme(), and I get the following error

AttributeError: module 'seaborn' has no attribute 'set_theme'.

但它应该根据 https://seaborn.pydata.org/tutorial/aesthetics.html

这是为什么?

推荐答案

sns.set_theme() 函数是在 v0.11 中添加的,您可能使用的是旧版本.安装 v0.11.0 或 v0.11.1conda install seaborn=0.11

sns.set_theme() function was added in v0.11, and you are likely using an older version. To install the v0.11.0 or v0.11.1 conda install seaborn=0.11

该功能以前以 sns.set 名称存在,并且在较新的版本中继续存在,因此更新不是绝对必要的.如果您想要旧版本 seaborn 上的功能,您可以运行 seaborn.set(),它是 0.11+ 中 sns.set_theme() 的别名.

The functionality previously existed under the name sns.set, and it continues to on newer versions, so updating is not strictly necessary. If you would like the functionality on an older version of seaborn, you can run seaborn.set(), which is an alias for sns.set_theme() in 0.11+.

这篇关于方法 seaborn.set_theme() 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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