首页 > 解决方案 > seaborn "kde jointplot" 在最新版本 (0.11.0) 中没有颜色映射

问题描述

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);

链接到图片(这是我的第一个问题,我无法嵌入图片)

标签: matplotlibseaborn

解决方案


该函数kdeplot(在内部jointplot()用于绘制二元密度图)在 v.0.11 中进行了广泛的更改。请参阅新增功能文档

您现在必须通过fill=True以获得填充的 KDE,并且您需要指定thresh=0是否要使用颜色填充可用空间。

sns.jointplot(x=v1, y=v3, kind='kde', space=0, fill=True, thresh=0, cmap='Blues');

在此处输入图像描述


推荐阅读