60 colormaps
Uncomment the following line to install geemap if needed.
In [1]:
Copied!
# !pip install geemap
# !pip install geemap
In [2]:
Copied!
import ee
import geemap
import geemap.colormaps as cm
import ee
import geemap
import geemap.colormaps as cm
In [3]:
Copied!
# geemap.update_package()
# geemap.update_package()
In [4]:
Copied!
cm.palettes.dem
cm.palettes.dem
Out[4]:
('006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5')
In [5]:
Copied!
cm.palettes.ndvi
cm.palettes.ndvi
Out[5]:
('FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301')
In [6]:
Copied!
cm.palettes.ndwi
cm.palettes.ndwi
Out[6]:
('#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858')
In [7]:
Copied!
cm.get_palette('terrain', n_class=8)
cm.get_palette('terrain', n_class=8)
Out[7]:
['333399', '0294fa', '24d36d', 'b6f08a', 'dbd085', '92735e', 'b6a29d', 'ffffff']
In [8]:
Copied!
cm.plot_colormap('terrain', width=8.0, height=0.4, orientation='horizontal')
cm.plot_colormap('terrain', width=8.0, height=0.4, orientation='horizontal')
In [9]:
Copied!
Map = geemap.Map()
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
Map = geemap.Map()
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
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Input In [9], in <cell line: 10>() 7 vis_params = {'min': 0, 'max': 4000, 'palette': palette} 9 Map.addLayer(dem, vis_params, 'SRTM DEM') ---> 10 Map.add_colorbar(vis_params, label="Elevation (m)", layer_name="SRTM DEM") 11 Map File ~/.local/lib/python3.9/site-packages/geemap/foliumap.py:839, in Map.add_colorbar(self, colors, vmin, vmax, index, caption, categorical, step, **kwargs) 836 if all(len(color) == 6 for color in colors): 837 colors = ["#" + color for color in colors] --> 839 colormap = LinearColormap( 840 colors=colors, index=index, vmin=vmin, vmax=vmax, caption=caption 841 ) 843 if categorical: 844 if step is not None: File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in LinearColormap.__init__(self, colors, index, vmin, vmax, caption) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in <listcomp>(.0) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:45, in _parse_color(x) 43 cname = _cnames.get(x.lower(), None) 44 if cname is None: ---> 45 raise ValueError('Unknown color {!r}.'.format(cname)) 46 color_tuple = _parse_hex(cname) 47 else: ValueError: Unknown color None.
In [10]:
Copied!
Map.add_colorbar(
vis_params, label="Elevation (m)", orientation="vertical", layer_name="SRTM DEM"
)
Map.add_colorbar(
vis_params, label="Elevation (m)", orientation="vertical", layer_name="SRTM DEM"
)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Input In [10], in <cell line: 1>() ----> 1 Map.add_colorbar( 2 vis_params, label="Elevation (m)", orientation="vertical", layer_name="SRTM DEM" 3 ) File ~/.local/lib/python3.9/site-packages/geemap/foliumap.py:839, in Map.add_colorbar(self, colors, vmin, vmax, index, caption, categorical, step, **kwargs) 836 if all(len(color) == 6 for color in colors): 837 colors = ["#" + color for color in colors] --> 839 colormap = LinearColormap( 840 colors=colors, index=index, vmin=vmin, vmax=vmax, caption=caption 841 ) 843 if categorical: 844 if step is not None: File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in LinearColormap.__init__(self, colors, index, vmin, vmax, caption) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in <listcomp>(.0) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:45, in _parse_color(x) 43 cname = _cnames.get(x.lower(), None) 44 if cname is None: ---> 45 raise ValueError('Unknown color {!r}.'.format(cname)) 46 color_tuple = _parse_hex(cname) 47 else: ValueError: Unknown color None.
In [11]:
Copied!
Map.add_colorbar(
vis_params,
label="Elevation (m)",
orientation="vertical",
layer_name="SRTM DEM",
transparent_bg=True,
)
Map.add_colorbar(
vis_params,
label="Elevation (m)",
orientation="vertical",
layer_name="SRTM DEM",
transparent_bg=True,
)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Input In [11], in <cell line: 1>() ----> 1 Map.add_colorbar( 2 vis_params, 3 label="Elevation (m)", 4 orientation="vertical", 5 layer_name="SRTM DEM", 6 transparent_bg=True, 7 ) File ~/.local/lib/python3.9/site-packages/geemap/foliumap.py:839, in Map.add_colorbar(self, colors, vmin, vmax, index, caption, categorical, step, **kwargs) 836 if all(len(color) == 6 for color in colors): 837 colors = ["#" + color for color in colors] --> 839 colormap = LinearColormap( 840 colors=colors, index=index, vmin=vmin, vmax=vmax, caption=caption 841 ) 843 if categorical: 844 if step is not None: File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in LinearColormap.__init__(self, colors, index, vmin, vmax, caption) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in <listcomp>(.0) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:45, in _parse_color(x) 43 cname = _cnames.get(x.lower(), None) 44 if cname is None: ---> 45 raise ValueError('Unknown color {!r}.'.format(cname)) 46 color_tuple = _parse_hex(cname) 47 else: ValueError: Unknown color None.
In [12]:
Copied!
Map.add_colorbar(
vis_params,
discrete=True,
label="Elevation (m)",
orientation="vertical",
layer_name="SRTM DEM",
)
Map.add_colorbar(
vis_params,
discrete=True,
label="Elevation (m)",
orientation="vertical",
layer_name="SRTM DEM",
)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Input In [12], in <cell line: 1>() ----> 1 Map.add_colorbar( 2 vis_params, 3 discrete=True, 4 label="Elevation (m)", 5 orientation="vertical", 6 layer_name="SRTM DEM", 7 ) File ~/.local/lib/python3.9/site-packages/geemap/foliumap.py:839, in Map.add_colorbar(self, colors, vmin, vmax, index, caption, categorical, step, **kwargs) 836 if all(len(color) == 6 for color in colors): 837 colors = ["#" + color for color in colors] --> 839 colormap = LinearColormap( 840 colors=colors, index=index, vmin=vmin, vmax=vmax, caption=caption 841 ) 843 if categorical: 844 if step is not None: File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in LinearColormap.__init__(self, colors, index, vmin, vmax, caption) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:196, in <listcomp>(.0) 194 else: 195 self.index = list(index) --> 196 self.colors = [_parse_color(x) for x in colors] File ~/.local/lib/python3.9/site-packages/branca/colormap.py:45, in _parse_color(x) 43 cname = _cnames.get(x.lower(), None) 44 if cname is None: ---> 45 raise ValueError('Unknown color {!r}.'.format(cname)) 46 color_tuple = _parse_hex(cname) 47 else: ValueError: Unknown color None.
In [13]:
Copied!
# cm.list_colormaps()
# cm.list_colormaps()
In [14]:
Copied!
cm.plot_colormaps(width=12, height=0.4)
cm.plot_colormaps(width=12, height=0.4)
Last update:
2022-03-14