title: Set color-palette in Seaborn Grouped Barplot depending on values
body: <p>I have a dataframe with positive and negative values from three kind of variables.</p>
  <pre><code>    labels  variable    value
  0   -10e5        nat     -38
  1     2e5        nat      50
  2    10e5        nat      16
  3   -10e5        agr     -24
  4     2e5        agr      35
  5    10e5        agr      26
  6   -10e5        art     -11
  7     2e5        art      43
  8    10e5        art      20
  </code></pre>
  <p>when values are negative I want the barplot to follow the color sequence:</p>
  <pre><code>n_palette = [&quot;#ff0000&quot;,&quot;#ff0000&quot;,&quot;#00ff00&quot;]
  </code></pre>
  <p>Instead when positive I want it to reverse the palette:</p>
  <pre><code>p_palette = [&quot;#00ff00&quot;,&quot;#00ff00&quot;,&quot;#ff0000&quot;]
  </code></pre>
  <p>I've tried this:</p>
  <pre><code>palette = [&quot;#ff0000&quot;,&quot;#ff0000&quot;,&quot;#00ff00&quot;,
             &quot;#00ff00&quot;,&quot;#00ff00&quot;,&quot;#ff00&quot;,
             &quot;#00ff00&quot;,&quot;#00ff00&quot;,&quot;#ff00&quot;]
  
  ax = sns.barplot(x=melted['labels'], y=melted['value'], hue = melted['variable'],
                   linewidth=1,
                   palette=palette)
  </code></pre>
  <p>But I get the following output:</p>
  <p><a href="https://i.stack.imgur.com/qTpJy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qTpJy.png" alt="enter image description here" /></a></p>
  <p>what I'd like is the first two bars of the group to become green and the last one red when values are positive.</p>