title: How to set custom colors on a count plot in seaborn
body: <p>I have created a set of raincloud plot distributions that follow a specific color scheme (Set2 from seaborn). I wanted to have my countplot match the colors by group listed (example: male and female counts would be green for the diet group, m:f counts would be pink for mod-pa etc). However I'm unable to align the color palette to both the x variable and the hue. It seems countplot will only color based on the hue. </p>
  
  <p><a href="https://i.stack.imgur.com/chDSF.png" rel="nofollow noreferrer">Color scheme of raincloud plots</a>
  <a href="https://i.stack.imgur.com/ZYSqi.png" rel="nofollow noreferrer">Color scheme of bar plot</a></p>
  
  <p>I have tried using set_colors to manipulate which bars to change color, I've also tried mapping colors based on conditionals like below, but nothing seems to be working.</p>
  
  <pre><code>ax = sns.countplot(x="Group", hue="Sex", data=df)
  ax[0].set_color('r')
  
  TypeError: 'AxesSubplot' object does not support indexing
  
  
  value=(df['Group']=='DIET') &amp; (df['Sex']=='Female')
  
  df['color']= np.where( value==True , "#9b59b6", "#3498db")
  
  ax = sns.countplot(x="Group", hue="Sex", data=df, color=df['color'])
  
  TypeError: 'Series' objects are mutable, thus they cannot be hashed
  </code></pre>
  
  <p>Full code</p>
  
  <pre><code>import pandas as pd
  
  import numpy as np
  
  import seaborn as sns
  
  df = pd.DataFrame({"Sex" : np.random.choice(["Male",  "Female"], size=1310, p=[.65, .35]),
                     "Group" : np.random.choice(["DIET", "MOD-PA", "HIGH-PA"],size=1310)})
  
  # Unique category labels: 'Diet', 'MOD-PA'...
  color_labels = df['Group'].unique()
  
  # List of color palette to use
  rgb_values = sns.color_palette("Set2", 6)
  
  # Map label to color palette
  
  color_map = dict(zip(color_labels, rgb_values))
  
  ax = sns.countplot(x="Group", hue="Sex", data=df, palette=df['Group'].map(color_map))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/HsBxn.png" rel="nofollow noreferrer">Even though I'm mapping to the x variable (group) it still maps onto the hue variable (sex)</a></p>