title: matplotlib uneven group size bar charts side-by-side
body: <p>I am trying to plot groups of data which have different bar sizes and may have different group sizes. How can I group the bars that belong to the same groups (shown as the same color) so that they are side by side? (Similar to <a href="http://matplotlib.org/examples/api/barchart_demo.html" rel="nofollow noreferrer">this</a>, except the same colors should be side-by-side)</p>
  
  <pre><code>width = 0.50      
  groupgap=2
  y1=[20,80]
  y2=[60,30,10]
  x1 = np.arange(len(y1))
  x2 = np.arange(len(y2))+groupgap
  ind = np.concatenate((x1,x2))
  fig, ax = plt.subplots()
  rects1 = ax.bar(x1, y1, width, color='r',  ecolor= "black",label="Gender")
  rects2 = ax.bar(x2, y2, width, color='b',  ecolor= "black",label="Type")
  ax.set_ylabel('Population',fontsize=14)
  ax.set_xticks(ind)
  ax.set_xticklabels(('Male', 'Female','Student', 'Faculty','Others'),fontsize=14)
  ax.legend()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RLAeP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RLAeP.png" alt="enter image description here"></a></p>