If we look into its source code, seaborn.regplot()
constructs two dictionaries scatter_kws
and line_kws
which are respectively passed off to calls to matplotlib's scatter()
and plot()
methods. In other words, the regression line and scatter points are plotted separately using separate kwargs. So for example, the regression line can have different alpha=
than scatter points.
In fact, a whole host of kwargs (e.g. marker size, edgecolors, alpha) that matplotlib's scatter()
admit are missing from regplot()
as a keyword but they can be collected in a dictionary and passed along via the scatter_kws
argument. Likewise for kwargs for plot()
and line_kws
argument.
import seaborn as sns
df = sns.load_dataset('tips')
ax = sns.regplot(x="total_bill", y="tip", data=df, ci=False,
scatter_kws=dict(alpha=0.5, s=30, color='blue', edgecolors='white'),
line_kws=dict(alpha=0.7, color='red', linewidth=3))
alpha
. – Underplot