在Python中使用seaborn制作坚固的轮廓

时间:2018-06-04 21:36:40

标签: python plot seaborn

我已使用seaborn, kdeplot检查this tutorial是否绘制了轮廓线。 此示例中的轮廓具有layers inside,但我想绘制一个实心轮廓,其中没有任何图层或线条。 我的意思是,我想填充轮廓以使偶数对象不是具有太多线条的轮廓。 有谁可以帮助我?

1 个答案:

答案 0 :(得分:0)

你指的是kdeplot。这通常需要一些轮廓才有意义。即从单个轮廓您无法知道数据的分布。

但是如果你仍然想要一个轮廓,你可以使用n_levels参数并将其设置为1

import matplotlib.pyplot as plt
import numpy as np; np.random.seed(10)
import seaborn as sns; sns.set(color_codes=True)
mean, cov = [0, 2], [(1, .5), (.5, 1)]
x, y = np.random.multivariate_normal(mean, cov, size=50).T

ax = sns.kdeplot(x, y, n_levels=1, cmap="Purples_d", shade=True, shade_lowest=True)

plt.show()

enter image description here