如何修复地理坐标的seaborn kde错误



我有以下数据帧(2000行(

Latitude    Longitude
31.400091   -109.782830
31.400091   -108.782830
31.410091   -108.782830
31.405091   -109.782830
31.400091   -110.77830
31.460091   -12.782830
...            ...

我目前正试图用来自海运包装的kde来表示点质量浓度:

x = df['Longitude']
y = df['Latitude']
x = x.to_numpy()
y = y.to_numpy()
sns.kdeplot(x, y, zorder=0, n_levels=6, shade=True, 
cbar=True, shade_lowest=False, cmap='viridis')

这给了我:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [58], in <cell line: 1>()
----> 1 sns.kdeplot(x, y, zorder=0, n_levels=6, shade=True, 
2     cbar=True, shade_lowest=False, cmap='viridis')
TypeError: kdeplot() takes from 0 to 1 positional arguments but 2 positional arguments (and 1 keyword-only argument) were given

我尝试过numpy数组转换,但没有它,结果是一样的。

我的seaborn版本:‘0.12.0’

试试这个:

sns.kdeplot(x=x, y=y, zorder=0, n_levels=6, shade=True, 
cbar=True, shade_lowest=False, cmap='viridis')

最新更新