Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

colorbar 'cmap' error #5

Open
khouakhi opened this issue Mar 7, 2021 · 0 comments
Open

colorbar 'cmap' error #5

khouakhi opened this issue Mar 7, 2021 · 0 comments

Comments

@khouakhi
Copy link

khouakhi commented Mar 7, 2021

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant