我做了一个看起来像这样的情节:
代码如下:
sn.kdeplot(data = pca_dataAPO, x = 'PC_1', y = 'PC_2', shade = True, cmap='viridis_r', bw_method = 'scott')
所以基本上,我似乎无法弄清楚如何平滑第一个图中的颜色,通过使它们变得暗淡,就像基本上混合它们一样。
我尝试这样做:
# 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()
但它给了我这个黄色背景,我找不到如何使背景变白的解决方法。
提前感谢您的帮助!