title: seaborn facetgrid: when hue value doesn't appear in all graphs the legend is misannotated
body: <p>I've also opened an issue in the seaborn git repo <a href="https://github.com/mwaskom/seaborn/issues/2916" rel="nofollow noreferrer">here</a>. However, instead of a bug, it's quite possible that instead I'm making some basic error - but I haven't figured it out yet...</p>
  <p><strong>Question:</strong>
  The same color is assigned to two different values in the legend. How to prevent this from happening as I scale up to more graphs that only contain a subset of the values assigned to the 'hue'?</p>
  <p><strong>The code to reproduce:</strong></p>
  <pre><code>import numpy as np
  import pandas as pd
  
  import seaborn as sns
  import matplotlib.pyplot as plt
  
  
  sna = pd.DataFrame(
      {
          'x' : np.tile(range(10), 5), 
          'y' : list(range(10)) + list(range(2,12)) + list(range(4, 14)) + list(range(6, 16)) + list(range(8, 18)),
          'id_for_hue' : ['foo']*10 + ['bar']*10 + ['baz']*10 + ['bar']*10 + ['baz']*10,
          'id_for_graph' : ['a']*30 + ['b']*20
      }                                
  )
  
  g = sns.FacetGrid(sna, col='id_for_graph')
  g.map_dataframe(
      sns.lineplot,
      x = 'x',
      y = 'y',
      hue = 'id_for_hue'
  )
  
  g.add_legend()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/y8Bhs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y8Bhs.png" alt="enter image description here" /></a></p>
  <p>On the other hand, if I sort so that the values from the second plot appear at the top of the dataframe, the problem is resolved.</p>
  <pre><code>g = sns.FacetGrid(sna.sort_values(['id_for_hue']), col='id_for_graph')
  g.map_dataframe(
      sns.lineplot,
      x = 'x',
      y = 'y',
      hue = 'id_for_hue'
  )
  
  g.add_legend()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Bmvyk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Bmvyk.png" alt="enter image description here" /></a></p>
  <p><strong>Versions:</strong></p>
  <ul>
  <li>seaborn: 0.11.2</li>
  <li>matplotlib: 3.5.2</li>
  <li>pandas: 1.3.4</li>
  <li>numpy: 1.21.6</li>
  <li>python: 3.7.6</li>
  </ul>