Search code examples
pythonmatplotliblayoutseaborn

Remove white border from dots in a seaborn scatterplot


The scatterplot from seaborn produces dots with a small white boarder. This is helpful if there are a few overlapping dots, but it becomes visually noisy once there are many overlaying dots. How can the white borders be removed?

import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
tips = sns.load_dataset("tips")
ax = sns.scatterplot(x="total_bill", y="tip", data=tips)

A seaborn scatterplot of the tips dataset.


Solution

  • Instead of edgecolors use linewidth = 0:

    import seaborn as sns; sns.set()
    import matplotlib.pyplot as plt
    tips = sns.load_dataset("tips")
    ax = sns.scatterplot(x="total_bill", y="tip", data=tips, linewidth=0)