title: How to add a colormap to a barplot (such as Viridis), varying color vertically?
body: <p>I want to to reproduce the BarPlots shown in this article: </p>
  
  <p><a href="https://pubs.acs.org/doi/10.1021/acsnano.8b04726" rel="nofollow noreferrer">https://pubs.acs.org/doi/10.1021/acsnano.8b04726</a></p>
  
  <p>I have already plotted the graph, but I can't get to color the bars with the Viridis Colormap like the authors did, where the greater the value the more yellow the bar becomes at the top. </p>
  
  <p>How can I use such a colormap to color the bars in Python?</p>
  
  <p>Thanks!</p>
  
  <p>Here is the code I'm using at Jupyter Notebook to plot the Bar Chart. </p>
  
  <pre class="lang-py prettyprint-override"><code>
  import numpy as np
  import matplotlib.pyplot as plt
  from cycler import cycler
  import matplotlib as mpl
  import pandas as pd
  
  #Imports data for the y-axis bars
  df = pd.read_excel('Mydata')
  heightof = df['pce']
  pce_std = [0.05, 0.11, 0, 0, 0.13, 0.32, 0.00007, 0.17, 0.05, 0.28, 0.08, 0.35, 0.04, 0.12, 0.10]
  axis_x = range(1,16)
  
  #Plots Bar Chart
  fig, ax1 = plt.subplots(1, 1, clear=True, figsize=(8,6))
  plt.bar(axis_x, heightof, width=0.9, bottom=0, align='center', yerr=pce_std)
  plt.ylabel('PCE / %', fontsize=15)
  plt.xlabel('N of Experiments', fontsize=15)
  plt.title(r"$\bf{a}$"+'    Run: 1', fontsize=20)
  plt.xticks(np.arange(1, 16, step=2), ('1-1', '1-3', '1-5', '1-7','1-9', '1-11', '1-13', '1-15'))
  ax1.xaxis.set_tick_params(labelsize=12)
  ax1.yaxis.set_tick_params(labelsize=12)
  
  plt.show()
  </code></pre>
  
  <p>However, my bars are all blue, and I want them to be colored like the ones shown in the article. </p>