首页 > 解决方案 > Seaborn 线图模块对象没有属性“线图”

问题描述

使用 seaborn 的文档代码生成线图会返回 AttributeError:“模块”对象没有属性“线图”。我已经更新了 seaborn 并重新导入了模块并再次尝试,没有运气。lineplot 是否退休了,还是发生了其他事情?

import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
fmri = sns.load_dataset("fmri")
ax = sns.lineplot(x="timepoint", y="signal", data=fmri)

标签: pythonmatplotlibvisualizationseaborn

解决方案


如果你使用 conda,你需要安装 seaborn 指定的版本:

conda install -c anaconda seaborn=0.9.0

正确安装 seaborn 0.9.0 后,您应该能够使用 lineplot 功能(至少它适用于我的)。

这样你就不必离开 conda 生态系统并使用 seaborn 和 pip。


推荐阅读