Skip to content

colorbar 'cmap' error  #5

@khouakhi

Description

@khouakhi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions