python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.94k stars 2.23k forks source link

i need help, don't want show the legend #1841

Closed AlineGobbi closed 1 year ago

AlineGobbi commented 1 year ago

Describe the bug I created a mapa, but i don't want show the legend

To Reproduce

mapa = folium.Choropleth( geo_data=merged.__geo_interface__, data=merged, columns=['cidade', 'Total CDI'], key_on='feature.properties.cidade', fill_color='Greens', nan_fill_color = 'grey', fill_opacity=0.7, line_opacity=0.2, name='Pacientes CDIs (cidades)' ).add_to(m)

Environment :

AlineGobbi commented 1 year ago

I solve the problem

mapa = folium.Choropleth( geo_data=merged.geo_interface, data=merged, columns=['cidade', 'Total CDI'], key_on='feature.properties.cidade', fill_color='Greens', nan_fill_color = 'grey', fill_opacity=0.7, line_opacity=0.2, name='Pacientes CDIs (cidades)' ).add_to(m)

mapa._children

for key in mapa._children: if key.startswith('color_map'): del(mapa._children[key])

mapa.add_to(m)