title: Why do sns.lmplot and FacetGrid+plt.scatter create different scatter points from the same data?
body: <p>I'm quite new to Python, pandas DataFrames and Seaborn. When I was trying to understand Seaborn better, particularly sns.lmplot, I came across a difference between two figures made of the same data, that I thought were supposed to look alike, and I wonder why that is.</p>
  
  <p>Data: My data is a pandas DataFrame that has 454 rows and 19 columns. The data relevant to this question includes 4 columns and looks something like this:</p>
  
  <p>Columns: Av_density;    pred2;  LOC;    Year;</p>
  
  <p>Variable type: Continuous variable; Continuous variable; Categorical variable 1...4;Categorical 2012...2014</p>
  
  <p>There are no missing data points.</p>
  
  <p>My aim is to draw a 2x2 figure panel describing the relationship between Av_density and pred2 separately for each LOC(=location) with years marked with different colours. I call seaborn with:</p>
  
  <pre><code>import seaborn as sns
  sns.set(style="whitegrid")
  np.random.seed(sum(map(ord, "linear_categorical")))
  </code></pre>
  
  <p>(<em>Side point: for some reason calling "linear_quantitative" does not work, i.e. I get a "File "stdin", line 2
      sns.lmplot("Av_density", "pred2", Data, col="LOC", hue="YEAR", col_wrap=2);</em><br>
   <em>^</em>
  <em>SyntaxError: invalid syntax"</em>)</p>
  
  <p><strong>Figure method 1, FacetGrid + scatter:</strong></p>
  
  <pre><code>sur=sns.FacetGrid(Data,col="LOC", col_wrap=2,hue="YEAR")
  sur.map(plt.scatter, "Av_density", "pred2" );
  plt.legend()
  </code></pre>
  
  <p>This produces a nice scatter of the data accurately. You can see the picture here:<a href="https://drive.google.com/file/d/0B7h2wsx9mUBScEdUbGRlRk5PV1E/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B7h2wsx9mUBScEdUbGRlRk5PV1E/view?usp=sharing</a></p>
  
  <p><strong>Figure method 2, sns.lmplot:</strong></p>
  
  <pre><code>sns.lmplot("Av_density", "pred2", Data, col="LOC", hue="YEAR", col_wrap=2);
  </code></pre>
  
  <p>This produces the figure panel divided by LOC accurately, with Years in different colours, but the scatter of the data points does not look right. Instead, it looks like lmplot has linearised the data points, and lost the original scatter points that it is supposed to be drawing in addition to the regression lines.
  You can see the figure here: <a href="https://drive.google.com/file/d/0B7h2wsx9mUBSRkN5ZXhBeW9ob1E/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B7h2wsx9mUBSRkN5ZXhBeW9ob1E/view?usp=sharing</a></p>
  
  <p>My data produces only three points per location per year, and I was first wondering if this is what makes the "mistake" in lmplot datapoint. Optimally I would have a shorter line describing the trend between years instead of a proper regression, but I have not figured out the code to this yet. </p>
  
  <p>But before tackling that issue, I would really like to know if there is something I am doing wrong that I can fix, or if this is an issue of lmplot trying to handle my data?</p>
  
  <p>Any help, comments and ideas on this are warmly welcome!</p>
  
  <p>-TA-</p>
  
  <p>Ps. I'm running Python 2.7.8 with Spyder 2.3.4</p>
  
  <p><strong>EDIT:</strong> <em>I get shorter "trend lines" with the first method by adding:</em></p>
  
  <pre><code>sur.map(plt.plot,"Av_density", "pred2" );
  </code></pre>
  
  <p><em>Still would like to know what is messing the figure with lmplot.</em></p>