python 2.7 - facecolor = 'none' (empty circles) not working using seaborn and .map -


i have following code trying plot 2 sets of data on same plot, markers being empty circles. expect inclusion of facecolor = 'none' in map function below accomplish this, not seem work. closest can below have red circles around red , blue dark dots.

x1 = np.random.randn(50) y1 = np.random.randn(50)*100 x2 = np.random.randn(50) y2 = np.random.randn(50)*100  df1 = pd.dataframe({'x1':x1, 'y1':y1}) df2 = pd.dataframe({'x2':x2, 'y2':y2})  df = pd.concat([df1.rename(columns={'x1':'x','y1':'y'})                 .join(pd.series(['df1']*len(df1), name='df')),                  df2.rename(columns={'x2':'x','y2':'y'})                 .join(pd.series(['df2']*len(df2), name='df'))],                ignore_index=true)  pal = dict(df1="red", df2="blue") g = sns.facetgrid(df, hue='df', palette=pal, size=5) g.map(plt.scatter, "x", "y", s=50, alpha=.7, linewidth=.5, facecolors = 'none', edgecolor="red") g.map(sns.regplot, "x", "y", ci=none, robust=1) g.add_legend() 

sns.regplot doesn't pass through keywords need this, can scatter explicitly, turning off regplot's scatter, , rebuilding legend:

g.map(plt.scatter, "x", "y", s=50, alpha=.7,       linewidth=.5,       facecolors = 'none',       edgecolor=['red', 'blue'])   g.map(sns.regplot, "x", "y", ci=none, robust=1,      scatter=false)  markers = [plt.line2d([0,0],[0,0], markeredgecolor=pal[key],                       marker='o', markerfacecolor='none',                       mew=0.3,                       linestyle='')             key in pal]  plt.legend(markers, pal.keys(), numpoints=1) plt.show() 

enter image description here


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -