相关疑难解决方法(0)

Seaborn Barplot上的标签轴

我正在尝试使用我自己的标签来制作Seaborn条形图,其代码如下:

import pandas as pd
import seaborn as sns

fake = pd.DataFrame({'cat': ['red', 'green', 'blue'], 'val': [1, 2, 3]})
fig = sns.barplot(x = 'val', y = 'cat', 
                  data = fake, 
                  color = 'black')
fig.set_axis_labels('Colors', 'Values')
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

但是,我得到一个错误:

AttributeError: 'AxesSubplot' object has no attribute 'set_axis_labels'
Run Code Online (Sandbox Code Playgroud)

是什么赋予了?

python matplotlib seaborn

95
推荐指数
4
解决办法
15万
查看次数

seaborn FutureWarning:将以下变量作为关键字参数传递:x, y

我想绘制一个seaborn regplot。我的代码:

x=data['Healthy life expectancy']
y=data['max_dead']
sns.regplot(x,y)
plt.show()
Run Code Online (Sandbox Code Playgroud)

然而,这给了我未来的警告错误。如何修复此警告?

FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid 
positional argument will be 'data', and passing other arguments without an explicit keyword will 
result in an error or misinterpretation.
Run Code Online (Sandbox Code Playgroud)

python plot seaborn

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×2

seaborn ×2

matplotlib ×1

plot ×1