如何使用 sns.kdeplot() 从热图中删除白色 shade/color?我只想要红色

How to remove the white shade/color from the heatmap using sns.kdeplot()? I just want the red color

from mplsoccer.pitch import Pitch
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import kde
from scipy.ndimage import gaussian_filter
from copy import copy
np.random.seed(19680801)

plt.style.use('dark_background')

fields = ['id', 'minute', 'result', 'X1', 'Y','xG','h_a','situation','season',
          'shotType','X']
df=pd.read_csv('shots.csv', skipinitialspace=True, usecols=fields)
fig, ax = pitch.draw()
sns.kdeplot(df.Y, df.X,shade=True, ax=ax, cmap='Reds',
              shade_lowest=False,levels=20,kernel='gau',gridsize=50,
              bw='scott',cut=0,cbar=True,)
ax.set_xlim(ax.get_xlim()[::-1])        # invert the axis
ax.yaxis.tick_right()  
plt.axis('off')
plt.show()

值 df.X 和 df.Y 介于 (0,1) 之间。 我只想要红色部分。在 matplotlib 中,我使用 vmin 参数消除了白色部分。这里可以做什么?

编辑:再想一想,如果颜色图从附图中的 12 开始,白色区域将被消除。所以颜色图从红色开始,以深红色结束。这就是我想要的。

我会使用这种方法从您的颜色图中挑选颜色:

from matplotlib import cm
from matplotlib.colors import ListedColormap

# select 42 colours from the "Reds" cmap
red_selection = cm.get_cmap("Reds", 42)

# select half of the colours, closest to Red and assign to a new colormap
red_cmap = ListedColormap(red_selection(range(42))[21:, :])

from mplsoccer.pitch import Pitch
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import kde
from scipy.ndimage import gaussian_filter
from copy import copy
np.random.seed(19680801)

plt.style.use('dark_background')

fields = ['id', 'minute', 'result', 'X1', 'Y','xG','h_a','situation','season',
          'shotType','X']
df=pd.read_csv('shots.csv', skipinitialspace=True, usecols=fields)
fig, ax = pitch.draw()
sns.kdeplot(df.Y, df.X,shade=True, ax=ax, cmap=red_cmap,
              shade_lowest=False,levels=20,kernel='gau',gridsize=50,
              bw='scott',cut=0,cbar=True,)
ax.set_xlim(ax.get_xlim()[::-1])        # invert the axis
ax.yaxis.tick_right()  
plt.axis('off')
plt.show()