fabianegli
fabianegli

Reputation: 2246

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.

Upvotes: 17

Views: 15198

Answers (3)

savingDuck468
savingDuck468

Reputation: 347

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

Upvotes: 4

ipj
ipj

Reputation: 3598

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)

Upvotes: 23

dm2
dm2

Reputation: 4275

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

Upvotes: 6

Related Questions