title: How to pass different scatter kwargs to facets in lmplot in Seaborn
body: <p>I'm trying to map a 3rd variable to the scatter point colour in the Seaborn lmplot. So <code>total_bill</code> on x, <code>tip</code> on y and point colour as function of <code>size</code>.</p>
  
  <p>It works when no faceting is enabled but fails when <code>col</code> is used because the colour array size does not match the size of the data plotted in each facet.</p>
  
  <p>This is my code</p>
  
  <pre><code>    import matplotlib as mpl
      import seaborn as sns
      sns.set(color_codes=True)
  
      # load data
      data = sns.load_dataset("tips")
  
      # size of data
      print len(data.index)
  
      ### we want to plot scatter point colour as function of variable 'size'
  
      # first, sort the data by 'size' so that high 'size' values are plotted
      # over the smaller sizes (so they are more visible)
  
      data = data.sort_values(by=['size'], ascending=True)
  
      scatter_kws = dict()
      cmap = mpl.cm.get_cmap(name='Blues')
  
      # normalise 'size' variable as float range needs to be
      # between 0 and 1 to map to a valid colour
      scatter_kws['c'] = data['size'] / data['size'].max()
  
      # map normalised values to colours
      scatter_kws['c'] = cmap(scatter_kws['c'].values)
  
      # colour array has same size as data
      print len(scatter_kws['c'])
  
      # this works as intended
      g = sns.lmplot(data=data, x="total_bill", y="tip", scatter_kws=scatter_kws)
  </code></pre>
  
  <p>The above works well and produces the following (not allowed to include images yet, so here's the link):</p>
  
  <p><a href="https://i.stack.imgur.com/Pg7g7.png" rel="nofollow noreferrer">lmplot with point colour as function of <code>size</code></a></p>
  
  <p>However, when I add <code>col='sex'</code> to lmplot (try code below), the issue is that the colour array has the size of the original dataset which is larger than the size of data plotted in each facet. So, for example <code>col='male'</code> has 157 data points so first 157 values from the colour array are mapped to the points (and these aren't even the correct ones). See below:</p>
  
  <p><a href="https://i.stack.imgur.com/VOLYa.png" rel="nofollow noreferrer">lmplot with point colour as function of <code>size</code> with col=sex</a></p>
  
  <pre><code>    g = sns.lmplot(data=data, x="total_bill", y="tip", col="sex", scatter_kws=scatter_kws)
  </code></pre>
  
  <p>Ideally, I'd like to pass an array of scatter_kws to the lmplot so that each facet uses the correct colour array (which I'd calculate before passing to lmplot). But that doesn't seem to be an option.</p>
  
  <p>Any other ideas or workarounds that still allow me to use the functionality of Seaborn's <code>lmplot</code> (meaning, without resorting to re-creating <code>lmplot</code> functionality from <code>FacetGrid</code>?</p>