我在运行 seaborn ver. 0.10.1
在我的 jupyter 笔记本上。今天早上我升级到最新版本0.11.0
.现在,我的 kde jointplot 没有提供它以前的颜色映射。代码是一样的。只是版本不同。
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib notebook
np.random.seed(1234)
v1 = pd.Series(np.random.normal(0,10,1000), name='v1')
v2 = pd.Series(np.random.normal(60,15,1000), name='v2')
v3 = pd.Series(2*v1 + v2, name='v3')
# set the seaborn style for all the following plots
sns.set_style('white')
sns.jointplot(v1, v3, kind='kde', space=0);
最佳答案
函数kdeplot
(由 jointplot()
在内部使用以绘制二元密度图)在 v.0.11 中进行了广泛的更改。见 What's new和 the documentation .
您现在必须通过 fill=True
要获得一个填充的 KDE,你需要指定 thresh=0
如果你想用颜色填充可用空间。
sns.jointplot(x=v1, y=v3, kind='kde', space=0, fill=True, thresh=0, cmap='Blues');
关于matplotlib - seaborn "kde jointplot"在最新版本 (0.11.0) 中没有颜色映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63842336/