title: How to increase contrast when plotting a netcdf using imshow in matplotlib?
body: <p>Is there a way to increase contrast when plotting data (from a netcdf) using imshow? In ArcMap this can be done using the 
  <a href="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/raster-and-images/stretch-function.htm#ESRI_SECTION1_51BA1FD553D7414E99437464CC363E43" rel="nofollow noreferrer">'stretch' function</a> but I would like a solution using matplotlib. </p>
  
  <pre><code>from netCDF4 import Dataset
  import matplotlib.pylab as plt
  fnc = Dataset(ncfile, 'r')
  lat = fnc.variables['latitude'][:]
  lon = fnc.variables['longitude'][:]
  level = fnc.variables['level'][:]
  mydata = fnc.variables['Data'][0, 0, :, :]
  plt.figure(figsize = (8, 4))
  imgplot = plt.imshow(mydata, cmap = 'YlGn')
  plt.colorbar()
  plt.show
  </code></pre>
  
  <p>Current output:</p>
  
  <p><a href="https://i.stack.imgur.com/zNEKhm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zNEKhm.png" alt="enter image description here"></a></p>
  
  <p>What I would like (a '2.5 standard deviation stretch'):</p>
  
  <p><a href="https://i.stack.imgur.com/42tRkm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/42tRkm.png" alt="enter image description here"></a></p>