title: Matplotlib Bar Plot with two Y-Axis and Common X-Axis
body: <p>I am trying to plot matplotlib bar plot with one y-axis on the left and another y on the right with a common x-axis.The range column is on the x-axis. Perc column is on left y-axis and the count column is on the right y-axis. Please advise how to proceed.</p>
  
  <p>Sample data is here - <a href="https://ufile.io/4wbcw" rel="nofollow noreferrer">SampleFileHere</a></p>
  
  <p><a href="https://i.stack.imgur.com/oPgp7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oPgp7.png" alt="enter image description here"></a></p>
  
  <pre><code>import numpy as np
  import pandas as pd
  import seaborn as sbn
  import matplotlib.pyplot as plt
  
  
  fig = plt.figure()
  ax = td['perc'].plot(kind="bar", alpha=0.7)
  plt.xticks(td['ranges'].tolist())
  ax2 = ax.twinx()
  ax2.plot(ax.get_xticks(),td['count'],marker='o', c='navy', linewidth=4)
  </code></pre>
  
  <p>I get the below error .</p>
  
  <pre><code>&lt;ipython-input-24-c1d398c0d012&gt; in &lt;module&gt;()
        7 fig = plt.figure()
        8 ax = td['perc'].plot(kind="bar", alpha=0.7)
  ----&gt; 9 plt.xticks(td['ranges'].tolist())
       10 ax2 = ax.twinx()
       11 ax2.plot(ax.get_xticks(),td['count'],marker='o', c='navy', linewidth=4)
  </code></pre>