title: stacked bar chart - space between y-axis and first bar: matplotlib.pyplot
body: <p>I am just starting out with matplotlib.pyplot and am a little stuck. </p>
  
  <p>Using the example in the matpltlib.pyplot documentation, I have created a stacked bar chart <img src="https://i.stack.imgur.com/sEs4V.png" alt="enter image description here"> using the following code:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  N = 7
  OECD = (242, 244, 255, 263, 269, 276, 285)
  NonOECD = (282, 328, 375, 417, 460, 501, 535)
  Sum = ('524', '572', '630', '680', '729', '777', '820')
  ind = np.arange(N)
  width = 0.5
  
  p1 = plt.bar(ind, NonOECD, width, color = 'r')
  p2 = plt.bar(ind, OECD, width, color = 'b', bottom = NonOECD)
  
  plt.ylabel('Quadrillion Btu')
  plt.title('World Total Energy Consumption 2010 - 2040')
  plt.xticks(ind+width/2., ('2010', '2015', '2020', '2025', '2030', '2035', '2040'))
  plt.yticks(np.arange(0, 1001, 200))
  plt.legend((p1[0], p2[0]), ('Non - OECD', 'OECD'), loc = 2, frameon = 'false')
  plt.tick_params(top = 'off', bottom = 'off', right = 'off')
  plt.grid(axis = 'y', linestyle = '-')
  
  plt.show()
  </code></pre>
  
  <p>However, I would prefer it if the first bar (2010) is not right up against the y-axis.<br>
  I have tried simply adding 1 to ind in both of plt1 and plt2<br>
  <em>i.e.</em></p>
  
  <pre><code>p1 = plt.bar(ind+1, NonOECD, width, color = 'r')  
  p2 = plt.bar(ind+1, OECD, width, color = 'b', bottom = NonOECD)
  </code></pre>
  
  <p>But, I am unable to work out the equivalent change for the ticklabels. So, thus far, all I produce is:  <img src="https://i.stack.imgur.com/7F2PR.png" alt="enter image description here"></p>
  
  <p>Having said that, I can fudge this by making N = 8, adding an additional zero first term in both the tuples? OECD and NonOECD and adding a blank xticklabel:<br>
  <em>i.e.</em>  </p>
  
  <pre><code>N = 8  
  OECD = (0, 242, 244, 255, 263, 269, 276, 285)  
  NonOECD = (0, 282, 328, 375, 417, 460, 501, 535)  
  Sum = (0, '524', '572', '630', '680', '729', '777', '820')  
  
  plt.xticks(ind+width/2., ('', '2010', '2015', '2020', '2025', '2030', '2035', 2040'))
  </code></pre>
  
  <p>However, I am unable to use this fudge as I want to display the totals  <a href="https://stackoverflow.com/questions/21688028/displaying-totals-above-stacked-bars-in-barchart-matplotlib-pyplot">on top of the stacks</a>....</p>