terrain_cmap_factory#
- pycraf.pathprof.terrain_cmap_factory(sealevel=0.5, vmin=-50, vmax=1200)[source]#
Produce terrain colormap and norm to be used in plt.imshow.
With this, one can adjust the colors in the cmap such that the sea level is properly defined (blue).
A simple use case would look like the following:
>>> vmin, vmax = -20, 1200 >>> terrain_cmap, terrain_norm = terrain_cmap_factory(vmin=vmin, vmax=vmax) >>> plt.imshow( ... heights, cmap=terrain_cmap, norm=terrain_norm, ... # vmin=vmin, vmax=vmax # deprecated in newer matplotlib versions ... )
- Parameters:
- Returns:
- terrain_cmap
matplotlib.colors.LinearSegmentedColormap
- terrain_norm
matplotlib.colors.Normalize
instance
- terrain_cmap