Choropleth Colors not Displaying
See original GitHub issueLike issue #92, the colors on the Choropleth are not displaying. What is odd is the quantiles are being set and the data.json file contains the valid values, but all of the shapes of the same color.
I’m doing something wrong, but can’t figure out what it is. The data files are in the same directory, so the solution isn’t the same as #92.
import folium
import pandas as pd
state_geo = r'gz_2010_us_040_00_20m.json'
population = r'd.csv'
state_data = pd.read_csv(population)
#Let Folium determine the scale
map = folium.Map(location=[48, -102], zoom_start=3)
map.geo_json(geo_path=state_geo, data=state_data, data_out='data.json',
columns=['state', 'D001'],
key_on='feature.NAME',
fill_color='YlGn', fill_opacity=0.7, line_opacity=0.1,
legend_name='population')
map.create_map(path='index.html')
Issue Analytics
- State:
- Created 8 years ago
- Comments:23 (11 by maintainers)
Top Results From Across the Web
Choropleth map is not showing color variation in the output
Choropleth map is not showing color variation in the output ; from pandas import ; import os import ; False) vis = os.path.join('Community_Areas....
Read more >Choropleth map not displaying colors · Issue #917 - GitHub
The geojson map is apparently rendering properly, but the colors from the values in the data.csv aren't showing up at all.
Read more >Filled map (choropleth) data colors not working
Solved: I'm working on trying to create shading (color scale) on a Filled Map. Following the instructions on.
Read more >Choropleth map not displaying color-Pandas,Python
[Solved]-Data visualization: Choropleth map not displaying color-Pandas,Python ... We need to link the country abbreviation name to GeoJson's ISO_A3. from urllib.
Read more >Colors not displaying on Plotly Choropleth Map in iPython ...
Hello I recently downloaded and installed plotly in order to create a Choropleth U.S. map of Zika cases in the iPython notebook.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is in your JSON:
You are using a
key_on=feature.NAME
and theNAME
does not exist inFeature
.NAME
is insideproperties
. The docs do say thatfeature.properties.NAME
should work, but I just tested that and it is broken. Your best option is to use this GeoJSON and adapt your DataFrame to be the two letter code for the states.(Next time please use links to all files. It is time consuming to copy-and-paste to create a csv just to test it.)
I’m trying to color zipcodes in King County according to mean housing prices.
geo_1 is a geojson for each zipcode in King County. It can be found here: https://gis-kingcounty.opendata.arcgis.com/datasets/zipcodes-for-king-county-and-surrounding-area-zipcode-area
final_df is a dataframe with two columns,
folium.Chloropleth() isn’t returning an error, but when I attempt to output m2, I receive this error message:
AttributeError: ‘NoneType’ object has no attribute ‘get’