title: How to sort axes in seaborn so that categories with most values are displayed
body: <p>I have a dataset with about 320k records. Of these, I want to display a swarmplot with the top 20 entities of the category in the x axis (<code>Refined_ID</code> in this case) by their count. How can one achieve that? For example, if my data is:</p>
  
  <pre><code>Refined_ID Refined_Age Name
  e123        21         foo1
  f123        19         bar1
  z123        26         foo2
  f123        29         bar2
  e123        20         foo1
  e1342       19         bar3
  f123        20         foo3
  </code></pre>
  
  <p>I would like my x-axis to be ordered as:</p>
  
  <pre><code>e123 f123 z123   
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>g = sns.swarmplot(x = dfAnalysis['Refined_ID'].iloc[:20],y = dfAnalysis['Refined_Age'], hue = dfAnalysis['Name'], orient="v")
  g.set_xticklabels(g.get_xticklabels(),rotation=30)
  </code></pre>
  
  <p>As the dataframe is quite large, am limiting the view to first 20 rows for testing.</p>
  
  <p>UPDATE 1</p>
  
  <p>Assuming there isn't a way to dynamically sort the axes in seaborn, this is what I want my output to look like:</p>
  
  <pre><code>Refined_ID Refined_Age     Name   Count_of_Refined_ID
      e123        21         foo1     2
      f123        19         bar1     3
      z123        26         foo2     1
      f123        29         bar2     3
      e123        20         foo1     3
      e1342       19         bar3     1
      f123        20         foo3     3
  </code></pre>
  
  <p>From this dataframe, I would then want to plot the top two <code>Refined_ID</code>s based on their count. In this case, those two categories will be <code>e123</code> and <code>f123</code>. The plot will have:</p>
  
  <pre><code>x-axis: Refined ID (e123 and f123)
  y-axis: Refined_Age (0 to 30)
  Hue: Based on Name
  </code></pre>