cartoee icon indicating copy to clipboard operation
cartoee copied to clipboard

colorbar 'cmap' error

Open khouakhi opened this issue 3 years ago • 0 comments

This example from the documentation of cartoee gives an error when adding cmap for the colorbar (but works when using custom palette)

# get an earth engine image
srtm = ee.Image("CGIAR/SRTM90_V4")
# vis 
visualization = {'min':-500,'max':3000,'bands':'elevation'}
bbox = [-180,-90,180,90]

# plot the map
ax = cee.getMap(srtm,cmap='terrain',
                region=bbox,
                visParams=visualization,
                dims=1000)
# add a color bar using cartoee
cb = cee.addColorbar(ax,loc='right',
                     cmap='terrain',
                     visParams=visualization)

ax.coastlines()

TypeError Traceback (most recent call last) in () 14 cb = cee.addColorbar(ax,loc='right', 15 cmap='terrain', ---> 16 visParams=visualization) 17 18 ax.coastlines()

2 frames /usr/local/lib/python3.7/dist-packages/matplotlib/cbook/init.py in _check_isinstance(_types, **kwargs) 2126 ", ".join(names[:-1]) + " or " + names[-1] 2127 if len(names) > 1 else names[0], -> 2128 type_name(type(v)))) 2129 2130

TypeError: 'cmap' must be an instance of matplotlib.colors.Colormap or None, not a str

khouakhi avatar Mar 07 '21 10:03 khouakhi