Remove background color in a kernel density plot ( seaborn.kdeplot)

Viewed 1460

I am trying to plot a Seaborn Kernel density over a map (Shapefile).

To generate the Kernel density, I used the following code in the Seaborn Website

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

Output plot

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.

This is an example of my output
ugly_map.

Solutions I'm also considering:

1-Control the alpha of the last color in the pallet( making one color gradient full transparency)?

2-A better way to plot Kernel density on a map?

Thanks,

J

1 Answers
Related