2016-03-06 223 views
4

我们可以得到一个情节一样波纹管如何更改seaborn线条颜色lmplot

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

但是,当我们有大量的数据点的回归线不再可见。我该如何改变线条的颜色?我找不到命令

回答

6

可以使用line_kwsscatter_kws将参数作为键值对(字典)提供给基础plt.plotplt.scatter函数。所以像line_kws = {'color': 'red'}应该做的工作:

g = sns.lmplot(x="total_bill", y="tip", 
       data=tips, line_kws={'color': 'red'}) 
sns.plt.show() 
+0

thanx很多@mgc – Edward