如何去除散点图中点之间的空格

时间:2021-05-25 12:45:13

标签: matplotlib plot seaborn scatter-plot

我已经使用 scatterplot 命令绘制了护士时间表图,但是每当点接近时,就会出现令人讨厌的空白,我想摆脱它。一个例子:

enter image description here

所以每当点接近时就会出现这个白色间隙......

为了绘制红点,我使用了这个命令:

sns.scatterplot(x='xaxis', y='nurses', data=df_plot, marker=',', color='r', s=400,ci=100)

1 个答案:

答案 0 :(得分:2)

看起来您的标记是用白边绘制的。您可以使用 edgecolor='None' 作为 sns.scatterplot 的选项来删除这些。

sns.scatterplot(x='xaxis', y='nurses', data=df_plot,
                marker=',', color='r', s=400, ci=100, edgecolor='None')

一个小例子来证明这一点:

import matplotlib.pyplot as plt
import seaborn as sns

fig, (ax1, ax2) = plt.subplots(ncols=2)
tips = sns.load_dataset("tips")

sns.scatterplot(ax=ax1, data=tips, x="total_bill", y="tip")
sns.scatterplot(ax=ax2, data=tips, x="total_bill", y="tip", edgecolor='None')

enter image description here

相关问题