python - Scatterplot without linear fit in seaborn -
i wondering if there way turn of linear fit in seaborn's lmplot
or if there equivalent function produces scatterplot. sure, use matplotlib, however, find syntax , aesthetics in seaborn quite appealing. e.g,. want plot following plot
import seaborn sns sns.set(style="ticks") df = sns.load_dataset("anscombe") sns.lmplot("x", "y", data=df, hue='dataset')
without linear fit so:
from itertools import cycle import numpy np import matplotlib.pyplot plt color_gen = cycle(('blue', 'lightgreen', 'red', 'purple', 'gray', 'cyan')) lab in np.unique(df['dataset']): plt.scatter(df.loc[df['dataset'] == lab, 'x'], df.loc[df['dataset'] == lab, 'y'], c=next(color_gen), label=lab) plt.legend(loc='best')
set fit_reg
argument false
:
sns.lmplot("x", "y", data=df, hue='dataset', fit_reg=false)
Comments
Post a Comment