2016-03-06 236 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