Python Seaborn密度图隐藏散点图

Python Seaborn密度图隐藏散点图,python,matplotlib,plot,seaborn,Python,Matplotlib,Plot,Seaborn,我想用seaborn绘制一个密度图,然后在该散点图上绘制数据,但是密度图隐藏了散点图的点。如何使点位于密度图上方 #!/usr/bin/env python3 import seaborn as sns import matplotlib.pyplot as plt df = sns.load_dataset('iris') fig = plt.figure() ax = fig.add_subplot(111) sns.kdeplot(df['sepal_width'], df['s

我想用seaborn绘制一个密度图,然后在该散点图上绘制数据,但是密度图隐藏了散点图的点。如何使点位于密度图上方

#!/usr/bin/env python3

import seaborn as sns
import matplotlib.pyplot as plt

df = sns.load_dataset('iris')

fig = plt.figure() 
ax = fig.add_subplot(111)

sns.kdeplot(df['sepal_width'], df['sepal_length'], ax = ax, bw = 0.4, cmap = 'Reds')
ax.scatter(df['sepal_width'], df['sepal_length'], s = 10)

fig.savefig('plot.pdf', bbox_inches='tight', dpi = 300)
尝试:

最大散射df['萼片宽度'],df['萼片长度'],s=10,zorder=2