matplotlib - seaborn "kde jointplot"在最新版本 (0.11.0) 中没有颜色映射

标签 matplotlib seaborn

我在运行 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);
Link to the image (This is my first question, I can't embed an image)

最佳答案

函数kdeplot (由 jointplot() 在内部使用以绘制二元密度图)在 v.0.11 中进行了广泛的更改。见 What's newthe documentation .
您现在必须通过 fill=True要获得一个填充的 KDE,你需要指定 thresh=0如果你想用颜色填充可用空间。

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

关于matplotlib - seaborn "kde jointplot"在最新版本 (0.11.0) 中没有颜色映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63842336/

相关文章:

python - Matplotlib 中的极坐标图未居中

python-3.x - Pandas 格式列作为货币

python - 根据数据点的数量在同一个坐标轴上绘制 swarmplot 或 boxplot

python - Matplotlib子图内容消失使用set_xlim,set_ylim

python - matplotlib 和阶乘函数

python - 系列图 - 将 y 轴设置为系列值

python-3.x - 使用 Seaborn kdeplot 进行对数缩放

python-3.x - 绘制Seaborn图并添加图例

python - Seaborn: ValueError: No for Palette ='jet'

python - 如何将 matplotlib 的 ggplot 风格与 agg 后端一起使用