title: How to autoscale y axis in matplotlib?
body: <p>I'm currently creating many plots and some look great while other need some adjustment.  From below how can I make the hard to see plot line easier to see without having to manually plot them?  I plot 50-100 of these at a time then add them to a pdf report.  I'd like to add space under the line, for example have ylim min limit set to -0.1, but do it automatically.</p>
  
  <p>This one is hard to see plot line:
  <img src="https://i.stack.imgur.com/eaX6i.png" alt="Hard to see plot line"></p>
  
  <p>This one is easy to see plot line:
  <img src="https://i.stack.imgur.com/fpvp3.png" alt="Easy to see plot line"></p>
  
  <p>Here is my code for plotting:</p>
  
  <pre><code>def plot(chan_data):
  '''Uses matplotlib to plot a channel
  '''
  f, ax = plt.subplots(1, figsize=(8, 2.5))
  x = dffinal['time'].keys()    
  ax.plot(x, dffinal[chan_data].values, linewidth=0.4, color='blue')
  ax.xaxis.set_major_formatter(mdates.DateFormatter('%m/%d/%Y - %H:%M'))
  ax.xaxis.set_major_locator(mdates.AutoDateLocator(interval_multiples=True))
  
  lgd1 = ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
  
  f.autofmt_xdate()
  ax.set_ylabel(dffinal[chan_data].name)
  ax.grid('on')
  
  #I've tried these with no luck
  #ax.autoscale(enable=True, axis='y', tight=False)
  #ax.set_ymargin(0.5)
  #ax.set_autoscaley_on(True)
  
  fname = ".\\plots\\" + chan_data + ".png"
  print "Creating: " + fname
  plt.savefig(fname, dpi=100, bbox_extra_artist=(lgd1,), bbox_inches='tight')
  plt.close()
  return fname    
  </code></pre>