[英]Remove background color in a kernel density plot ( seaborn.kdeplot)
I am trying to plot a Seaborn Kernel density over a map (Shapefile). 我正在尝试在地图上绘制Seaborn内核密度(Shapefile)。
To generate the Kernel density, I used the following code in the Seaborn Website 为了生成内核密度,我在Seaborn 网站中使用了以下代码
x, y = np.random.multivariate_normal([0, 0], [[1, -.5], [-.5, 1]], size=300).T
cmap = sns.cubehelix_palette(light=1, as_cmap=True)
sns.kdeplot(x, y, cmap=cmap, shade=True);
My issue is that the Kernel white background is hiding my map. 我的问题是内核白色背景隐藏了我的地图。 The only way to remove it is to set
shade=False
but that's not what I am looking for. 删除它的唯一方法是设置
shade=False
但这不是我想要的。
This is an example of my output 这是我的输出的一个例子
.
。
Solutions I'm also considering: 我也在考虑的解决方案:
1-Control the alpha of the last color in the pallet( making one color gradient full transparency)? 1-控制托盘中最后一种颜色的Alpha(使一个颜色渐变完全透明)?
2-A better way to plot Kernel density on a map? 2-在地图上绘制内核密度的更好方法?
Thanks, 谢谢,
J Ĵ
I have same issue when I was drawing 2 kernel density estimation pot on single background image using seaborn. 我在使用seaborn在单个背景图像上绘制2个内核密度估算罐时遇到了相同的问题。 This trick solve my problem.
这个技巧解决了我的问题。
https://github.com/mwaskom/seaborn/issues/393#issuecomment-113420952 https://github.com/mwaskom/seaborn/issues/393#issuecomment-113420952
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.