Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Customizing legend seems to have no effect #1520

Closed
jportolese opened this issue Apr 25, 2023 · 2 comments
Closed

Customizing legend seems to have no effect #1520

jportolese opened this issue Apr 25, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jportolese
Copy link

jportolese commented Apr 25, 2023

Mon Apr 24 23:02:13 2023 Eastern Daylight Time

OS | Windows | CPU(s) | 20 | Machine | AMD64
Architecture | 64bit | RAM | 63.9 GiB | Environment | Jupyter
Python 3.8.16 (default, Jan 17 2023, 22:25:28) [MSC v.1916 64 bit (AMD64)]
geemap | 0.20.4 | ee | 0.1.339 | ipyleaflet | 0.17.2
folium | 0.13.0 | jupyterlab | 3.5.3 | notebook | 6.5.2
ipyevents | 2.0.1 | geopandas | 0.12.2 |   |  
Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture a

Description

Running the unsupervised classification tutorial and tried to make a change to the colors and the legend entries to replace the "one, two, three, four, etc" and it seems to ignore the updates and continues to show the standard legend.

Ran the following code:

legend_classes = ['Urban1', 'Urban2', 'Veg1', 'Veg2', 'Water']
legend_cols = ['#595959', '#d9d9d9', '#004d1a', '#00cc44', '#0066ff']

# Reclassify the map
result = result.remap([0, 1, 2, 3, 4], [1, 2, 3, 4, 5])

Map=geemap.Map()
Map.centerObject(point, 12)

Map.addLayer(
    result, {'min': 1, 'max': 5, 'palette': legend_cols},  'Labelled clusters'
)
Map.add_legend(
    legend_keys=legend_classes, legend_colors=legend_cols, position='bottomright'
)
Map

Screenshot 2023-04-24 230752

@jportolese jportolese added the bug Something isn't working label Apr 25, 2023
@giswqs
Copy link
Member

giswqs commented Apr 25, 2023

The parameter names have changed. It should be labels and colors instead of legend_keys and legend_colors.

https://geemap.org/geemap/#geemap.geemap.Map.add_legend

@giswqs giswqs closed this as completed Apr 25, 2023
@jportolese
Copy link
Author

jportolese commented Apr 26, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants