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)
To set the size of markers, we can use the s parameter. This parameter can be used since seaborn is built on the matplotlib module. We can specify this argument in the scatterplot() function and set it to some value. Alternatively, we can control the size of the points based on some variables.
The despine() is a function that removes the spines from the right and upper portion of the plot by default. sns. despine(left = True) helps remove the spine from the left.
Changing Marker Color on a Scatter Plot Behind the scenes, Seaborn scatter plots use the Matplotlib color styles. Here are the color codes for the basic colors you can use for your scatter plot markers. Pass the value in the argument column to the color parameter to change your marker colors.
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:
Try passing the argument edgecolor='none'
or edgecolor=None
into sns.scatterplot()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With