Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the line color in seaborn lmplot

We can get a plot as bellow

import numpy as np, pandas as pd; np.random.seed(0)
import seaborn as sns; sns.set(style="white", color_codes=True)
tips = sns.load_dataset("tips")
g = sns.lmplot(x="total_bill", y="tip", data=tips)
sns.plt.show()

enter image description here

But when we have a lot of data points the regression line is not visible anymore. How can I change the line's color? I couldn't find anymore command

like image 693
Edward Avatar asked Mar 06 '16 13:03

Edward


1 Answers

You can give arguments as key-value pairs (dictionary) to the underlying plt.plot and plt.scatter functions with line_kws and scatter_kws. So something like line_kws = {'color': 'red'} should do the job :

g = sns.lmplot(x="total_bill", y="tip",
               data=tips, line_kws={'color': 'red'})
sns.plt.show()
like image 175
mgc Avatar answered Oct 02 '22 22:10

mgc