Skip to content

Instantly share code, notes, and snippets.

View wrobstory's full-sized avatar

Rob Story wrobstory

View GitHub Profile
@wrobstory
wrobstory / README.md
Last active April 22, 2019 17:24
Folium Choropleth Default

A Leaflet.js map created with Folium and the default D3 threshold scale. See the Gist for the python code to generate the dataframe. The map was generated with the following Python code:

map = folium.Map(location=[48, -102], zoom_start=3)
map.geo_json(geo_path=state_geo, data=state_data,
             columns=['State', 'Unemployment'],
             key_on='feature.id',
             fill_color='YlGn', fill_opacity=0.7, line_opacity=0.2,
             legend_name='Unemployment Rate (%)')
map.create_map(path='us_states.html')
@wrobstory
wrobstory / README.md
Last active March 22, 2022 20:03
Folium Choropleth Custom

A Leaflet.js map created with Folium and the default D3 threshold scale. See the Gist for the python code to generate the dataframe. The map was generated with the following Python code:

map.geo_json(geo_path=state_geo, data=state_data,
             columns=['State', 'Unemployment'],
             threshold_scale=[5, 6, 7, 8, 9, 10],
             key_on='feature.id',
             fill_color='BuPu', fill_opacity=0.7, line_opacity=0.5,
             legend_name='Unemployment Rate (%)',
 reset=True)
@wrobstory
wrobstory / README.md
Last active March 22, 2022 21:06
Folium Employed Choropleth

A Leaflet.js map created with Folium and the default D3 threshold scale, with data bound between the Pandas DataFrame and the TopoJSON. See the Gist for the python code to generate the dataframe. The map was generated with the following Python code:

map_1 = folium.Map(location=[48, -102], zoom_start=3)
map_1.geo_json(geo_path=county_geo, data_out='data1.json', data=df,
               columns=['GEO_ID', 'Employed_2011'],
               key_on='feature.id',
               fill_color='YlOrRd', fill_opacity=0.7, line_opacity=0.3,
               topojson='objects.us_counties_20m')
map_1.create_map(path='map_1.html')
@wrobstory
wrobstory / README.md
Last active December 17, 2015 12:29
Folium Unemployment Choropleth

A Leaflet.js map created with Folium and a custom D3 threshold scale, with data bound between the Pandas DataFrame and the TopoJSON. See the Gist for the python code to generate the dataframe. The map was generated with the following Python code:

map_2 = folium.Map(location=[40, -99], zoom_start=4)
map_2.geo_json(geo_path=county_geo, data_out='data2.json', data=df,
               columns=['GEO_ID', 'Unemployment_rate_2011'],
               key_on='feature.id',
               threshold_scale=[0, 5, 7, 9, 11, 13],
               fill_color='YlGnBu', line_opacity=0.3,
 legend_name='Unemployment Rate 2011 (%)',
@wrobstory
wrobstory / README.md
Last active April 15, 2020 03:18
Folium Income Choropleth

A Leaflet.js map created with Folium and a custom D3 threshold scale, with data bound between the Pandas DataFrame and the TopoJSON. See the Gist for the python code to generate the dataframe. The map was generated with the following Python code:

map_3 = folium.Map(location=[40, -99], zoom_start=4)
map_3.geo_json(geo_path=county_geo, data_out='data3.json', data=df,
               columns=['GEO_ID', 'Median_Household_Income_2011'],
               key_on='feature.id',
               fill_color='PuRd', line_opacity=0.3,
               legend_name='Median Household Income 2011 ($)',
 topojson='objects.us_counties_20m')
@wrobstory
wrobstory / README.md
Last active February 6, 2016 19:02
d3.chart Choropleths

Choropleth charts built with the d3.chart framework. choropleth_chart.js is the chart type definition, which allows for rapid iteration of different quantize-scale domain/range, colors, and projections. The colors are based on color brewer, and you can pass any of the sequential scale abbreviations ('BuGn', 'PuBuGn', etc) to the range parameter to iterate on colors.

@wrobstory
wrobstory / README.md
Last active May 1, 2020 02:31
Choropleth with Vincent

Demonstration of binding Vincent graphs to individual GeoJSON data.

@wrobstory
wrobstory / README.md
Last active December 18, 2015 13:59
Stack Overflow McFlyin + Bearcart

This visualization was created by calling the McFlyin API with the Stack Overflow data from the examples folder, then calling Bearcart on it. See the Python file in the Gist for the code.

@wrobstory
wrobstory / README.md
Last active November 16, 2024 13:38
D3 Brush and Tooltip Complete

Example for Cooperative Brushing and Tooltips in D3.

The completed chart, with both tooltips and brushing working cooperatively. You can start a brush-zoom on either the background or a data point.

@wrobstory
wrobstory / README.md
Last active December 29, 2015 06:38
D3 Brush and Tooltip I