title: python + matplotlib: barh plot show incomplete YTick labels - how to dynamically move the plot area to the right to fit the given YTickLabels?
body: <p>I'm using <code>matplotlib</code> to plot a <code>barh</code> plot to a file. Unfortunate, the YTickLaels are a bit too long and the plot area won't move to the right automatically. Is there a way to move the plot area to the right automatically so I won't have problems with incomplete YTickLabels? </p>
  
  <p>The code I use is the following:</p>
  
  <pre><code>import matplotlib as mpl
  mpl.use('Agg')
  import matplotlib.pyplot as plt
  D = {u'Label1':26, u'Label2 is longer than others': 17, u'Label3 is not so short either':30}
  fig = plt.figure(figsize=(5.5,3),dpi=300)
  ax = fig.add_subplot(111)
  ax.grid(True,which='both')
  bar = ax.barh(range(1,len(D)+1,1),D.values(),0.4,align='center')
  plt.yticks(range(1,len(D)+1,1), D.keys(), size='small')
  fig.savefig('D_bar.png')
  </code></pre>
  
  <p>Here is the output: 
  <img src="https://i.stack.imgur.com/Mv60k.png" alt="output of barh"></p>
  
  <p>How can I fix this? Thanks</p>