Skip to content

Choropleth map not displaying colors #917

Closed
@NavarroMauro

Description

@NavarroMauro

I am trying to make a choropleth map using data stored in a '.csv' over a '.geojson' polygon map. The geojson map is apparently rendering properly, but the colors from the values in the data.csv aren't showing up at all. I am new using folium and after reading the whole documentation I can't still figure out what I am doing wrong! I have posted the jupyter notebook and all data in a github repository.

I am working in a conda environment using folium '0.5.0'

Thanks in advance!

https://github.com/transluciddata/folium_problem

https://nbviewer.jupyter.org/github/transluciddata/folium_problem/blob/master/prueba.ipynb

import pandas as pd
import folium
import json
import os

regiones_data = os.path.join('regiones.csv')
regiones_geo = os.path.join('regiones.geojson')

data = pd.read_csv(regiones_data, na_values=[' '])

data.info()

m = folium.Map(
    location=[-37.807973, -71.894346], 
    tiles='Mapbox Bright',
    zoom_start=4,
    control_scale=True
)

m.choropleth(
    geo_data=regiones_geo,
    name='choropleth',
    data=data,
    columns=['region_id', 'votos_tricel'],
    key_on='feature.properties.region_id',
    fill_color='BuPu',
    fill_opacity=.7,
    line_opacity=.5,
    highlight=True,
    legend_name='Numero Total de Votos',
    reset=True
)

folium.LayerControl().add_to(m)

m

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThe issue contains a question about how to do something

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions