Remove white border from dots in a seaborn scatterplot

Viewed 5603

The scatterplot from seaborn produces dots with a small white boarder. This is helful if there are a few ovelapping dots, but it becomes really impractical 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.

3 Answers

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)

If you check searbon documentation, it accepts matplotlib keywords (listed kwargs in seaborn functions' documentaion), therefore, you can either pass, as sugested by @Allan Bruno edgecolor = 'none', edgecolor = None (singular, not 'edgecolors'), or linewidth = 0

Output:

enter image description here

Try passing the argument edgecolor='none' or edgecolor=None into sns.scatterplot()

Related