title: how to combine two bar chart of two files in one diagram in matplotlib pandas
body: <p>I have two dataframe with the same columns but different content.
  I have plotted <code>dffinal data frame</code>. now I want to plot another dataframe <code>dffinal_no</code> on the same diagram to be comparable.</p>
  
  <p>for example one bar chart in <code>blue colour</code>, and the same bar chart with another colour just <code>differentiating in y-axis</code>.</p>
  
  <p>This is part of the code in which I have plotted the first data frame.</p>
  
  <pre><code>dffinal = df[['6month','final-formula','numPatients6month']].drop_duplicates().sort_values(['6month'])
  
  ax=dffinal.plot(kind='bar',x='6month', y='final-formula')
  import matplotlib.pyplot as plt
  ax2 = ax.twinx()
  dffinal.plot(ax=ax2,x='6month', y='numPatients6month')
  plt.show()
  </code></pre>
  
  <p>Now imagine I have another <code>dffinal_no</code> data frame with the same columns, how can I plot it in the same diagram?</p>
  
  <p>This is my first diagram which I plotted, I want the other bar chart on this diagram with another color.</p>
  
  <p><a href="https://i.stack.imgur.com/WLxbg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WLxbg.png" alt="enter image description here"></a></p>
  
  <p>so the answer of @Mohamed Thasin ah is somehow what I want, except that the right y-axis is not correct.</p>
  
  <p>I want <code>both data frame</code> be based on <code>(6month, final-formula)</code> but the right <code>y-axis</code> is just showing number of patients, as an information for the user.</p>
  
  <p>Actually, I <code>DO NOT</code> want the first df based on <code>final-fomula</code> and the second df be based on <code>NumberPatients</code>.</p>
  
  <p><strong>Update1 jast as a refrence how it looks like my data frame</strong></p>
  
  <pre><code>dffinal = df[['6month','final-formula','numPatients6month']].drop_duplicates().sort_values(['6month'])
  nocidffinal = nocidf[['6month','final-formula','numPatients6month']].drop_duplicates().sort_values(['6month'])
  fig = plt.figure()
  ax1 = fig.add_subplot(111)
  ax2 = ax1.twinx()
  ax1.set_ylabel('final-formula')
  ax2.set_ylabel('numPatients6month')
  width=0.4
  nocidffinal=nocidffinal.set_index('6month').sort_index()
  dffinal=dffinal.set_index('6month').sort_index()
  nocidffinal['final-formula'].plot(kind='bar',color='green',ax=ax1,width=width,position=0)
  dffinal['numPatients6month'].plot(kind='bar',color='red',ax=ax2,width=width,position=1)
  
  dffinal content
  
  ,6month,final-formula,numPatients6month
  166047.0,1,7.794117647058823,680
  82972.0,2,5.720823798627003,437
  107227.0,3,5.734767025089606,558
  111330.0,4,4.838709677419355,434
  95591.0,5,3.3707865168539324,534
  95809.0,6,3.611738148984198,443
  98662.0,7,3.5523978685612785,563
  192668.0,8,2.9978586723768736,467
  89460.0,9,0.9708737864077669,515
  192585.0,10,2.1653543307086616,508
  184325.0,11,1.727447216890595,521
  85068.0,12,1.0438413361169103,479
  
  nocidffinal
  
  ,6month,final-formula,numPatients6month
  137797.0,1,3.5934291581108826,974
  267492.0,2,2.1705426356589146,645
  269542.0,3,2.2106631989596877,769
  271950.0,4,2.0,650
  276638.0,5,1.5587529976019185,834
  187719.0,6,1.9461077844311379,668
  218512.0,7,1.1406844106463878,789
  199830.0,8,0.8862629246676514,677
  269469.0,9,0.3807106598984772,788
  293390.0,10,0.9668508287292817,724
  254783.0,11,1.2195121951219512,738
  300974.0,12,0.9695290858725761,722
  </code></pre>