I made a plot that looks like so:
Here is the code:
sn.kdeplot(data = pca_dataAPO, x = 'PC_1', y = 'PC_2', shade = True, cmap='viridis_r', bw_method = 'scott')
So basically, I can not seem to figure out how to smoothen the colors in the first plot, by making them ombre, like basically blending them.
I tried doing it like so:
# Evaluate a gaussian kde on a regular grid of nbins x nbins over data extents
#nbins=300
k = gaussian_kde([pc_1,pc_2], 'scott')
xi, yi = np.mgrid[pc_1.min():pc_1.max(), pc_2.min():pc_2.max()]
zi = k(np.vstack([xi.flatten(), yi.flatten()]))
# Make the plot
plt.pcolormesh(xi, yi, zi.reshape(xi.shape), shading='gouraud', cmap='viridis_r')
plt.grid(linewidth=0.1)
plt.show()
But it gives me this yellow background and I can not find a workaround how to make the background white.
Thank you for the help in advance!
question from:
https://stackoverflow.com/questions/65889837/smoothing-out-the-plot-colors-making-the-colors-blend 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…