Saudia XYZ logo Code: Colormaps
Main Source: Geemap
Edited by: Saudia.xyz

Uncomment the following line to install geemap if needed.

In [ ]:
# !pip install geemap
In [1]:
import ee
import geemap
import geemap.colormaps as cm
In [ ]:
# geemap.update_package()
In [2]:
cm.palettes.dem
Out[2]:
('006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5')
In [3]:
cm.palettes.ndvi
Out[3]:
('FFFFFF',
 'CE7E45',
 'DF923D',
 'F1B555',
 'FCD163',
 '99B718',
 '74A901',
 '66A000',
 '529400',
 '3E8601',
 '207401',
 '056201',
 '004C00',
 '023B01',
 '012E01',
 '011D01',
 '011301')
In [4]:
cm.palettes.ndwi
Out[4]:
('#ece7f2',
 '#d0d1e6',
 '#a6bddb',
 '#74a9cf',
 '#3690c0',
 '#0570b0',
 '#045a8d',
 '#023858')
In [5]:
cm.get_palette('terrain', n_class=8)
Out[5]:
['333399',
 '0294fa',
 '24d36d',
 'b6f08a',
 'dbd085',
 '92735e',
 'b6a29d',
 'ffffff']
In [6]:
cm.plot_colormap('terrain', width=8.0, height=0.4, orientation='horizontal')
In [14]:
Map = geemap.Map(center=[24.5, 46.5], zoom=5)

palette = cm.palettes.dem
# palette = cm.palettes.terrain

dem = ee.Image('USGS/SRTMGL1_003')
vis_params = {
  'min': 0,
  'max': 4000,
  'palette': palette}

Map.addLayer(dem, vis_params, 'SRTM DEM')
Map.add_colorbar(vis_params, label="Elevation (m)", layer_name="SRTM DEM")
Map
In [15]:
Map.add_colorbar(vis_params, label="Elevation (m)", orientation="vertical", layer_name="SRTM DEM")
In [16]:
Map.add_colorbar(vis_params, label="Elevation (m)", orientation="vertical", layer_name="SRTM DEM", transparent_bg=True)
In [10]:
Map.add_colorbar(vis_params, discrete=True, label="Elevation (m)", orientation="vertical", layer_name="SRTM DEM")
In [11]:
# cm.list_colormaps()
In [12]:
cm.plot_colormaps(width=12, height=0.4)