title: Annotate bars with values on Pandas (on Seaborn factorplot bar plot)
body: <p>I wrote some code to try and solve this question:
  <a href="https://stackoverflow.com/questions/39477748/how-to-annotate-bars-with-values-on-pandas-on-seaborn-factorplot-bar-plot">https://stackoverflow.com/questions/39477748/how-to-annotate-bars-with-values-on-pandas-on-seaborn-factorplot-bar-plot</a></p>
  
  <p>I used part of the code that can be found here:
  <a href="https://stackoverflow.com/questions/19917587/matplotlib-advanced-bar-plot/19919397#19919397">matplotlib advanced bar plot</a></p>
  
  <p>Why is the graph so small? The code just tells to grab the accuracies from Pandas dataframe . </p>
  
  <p><a href="https://i.stack.imgur.com/4fK0U.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4fK0U.png" alt="enter image description here"></a></p>
  
  <p>The code: </p>
  
  <pre><code>sns.set(style="white")
  g = sns.factorplot(x="Stages", y="Accuracy", hue="Dataset", data=df, saturation = 5, size=4, aspect=2, kind="bar",
                palette= myPalette, legend=False)
  
  ax=g.ax
  def annotateBars(row, ax=ax):
      if row['Accuracy'] &lt; 20:
          color = 'white'
          vertalign = 'bottom'
          vertpad = 2
      else:
          color = 'black'
          vertalign = 'top'
          vertpad = -2
  
      ax.text(row.name, row['Accuracy'] + vertpad, "{:.1f}%".format(row['Accuracy']),
              zorder=10, rotation=90, color=color,
              horizontalalignment='center',
              verticalalignment=vertalign,
              fontsize=12, weight='heavy')
  
  junk = df.apply(annotateBars, ax=ax, axis=1)
  </code></pre>
  
  <p>This is code to annotate each bar, but ...with Pandas and Matplotlib. The only problem is that I do not know how to change colors and group the "x axis" :(</p>
  
  <pre><code>    df = df.set_index('Stages')
      ax = df.plot.bar(title="Accuracy")
      ax.set_ylim(0, 120)
      for p in ax.patches:
          ax.annotate("%.2f" % p.get_height(), (p.get_x() + p.get_width() / 2., p.get_height()),
               ha='center', va='center', rotation=90, xytext=(0, 20), textcoords='offset points')  #vertical bars
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/R6h18.png" rel="noreferrer"><img src="https://i.stack.imgur.com/R6h18.png" alt="enter image description here"></a></p>