title: Select part of the colormap plotting terrain
body: <h3>Data</h3>
  
  <ul>
  <li><p>the .tif data <strong>DEM</strong> was the altitude value represent the hypsography of one administrative division. I upload it <a href="https://drive.google.com/file/d/0B7FE0kxAL8kQdDRERG02ZVJya00/view?usp=sharing" rel="nofollow noreferrer">here</a>      </p></li>
  <li><p>The area besides the division I don't want to show them on the plot. </p></li>
  </ul>
  
  <h3>My aim</h3>
  
  <p>Plotting the hypsography of this division using <code>plt.pcolormesh</code>(<em>PS: I found out with reading .tif, <code>plt.imshow()</code> was way faster than <code>pcolormesh</code>. And I don't know Why</em>).   </p>
  
  <p>Here I show one example which I clipped from internet.    </p>
  
  <p><a href="http://7xrn7f.com1.z0.glb.clouddn.com/16-3-10/56951530.jpg" rel="nofollow noreferrer">http://7xrn7f.com1.z0.glb.clouddn.com/16-3-10/56951530.jpg</a>      </p>
  
  <h3>My attempt</h3>
  
  <pre><code>### Using GDAL to read the .tif data
  from osgeo import gdal
  ### Read the .tif
  pathToRaster = r'./dem.tif'
  raster = gdal.Open(pathToRaster,  gdal.GA_ReadOnly)
  dem = raster.GetRasterBand(1).ReadAsArray()
  dem = dem[::-1]       
  
  ### Mask the outside value
  dem_mask = np.ma.masked_less(dem,0)
  plt.pcolormesh(dem_mask,cmap =plt.cm.terrain)
  </code></pre>
  
  <h3>Result</h3>
  
  <p><a href="http://7xrn7f.com1.z0.glb.clouddn.com/16-3-10/45669007.jpg" rel="nofollow noreferrer">http://7xrn7f.com1.z0.glb.clouddn.com/16-3-10/45669007.jpg</a></p>
  
  <h3>Problem</h3>
  
  <p>In my research division, this area didn't contain the Sea/Ocean which are plotted by <code>blue</code> above.     </p>
  
  <p>But I want to use the <code>plt.cm.terrain</code> as my <code>pcolormesh</code>'s colormap because it fit the situation.  </p>
  
  <p>So, I want to <strong>remove the blue part of the colormap</strong>, and start the terrain using <code>green</code> representing the plain.</p>