我正在尝试使用我自己的标签来制作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)
是什么赋予了?
我想绘制一个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)