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 December 17, 2015 05:49
Bearcart Negative Y-axis

Bearcart with negative data on the y-axis.

@wrobstory
wrobstory / README.md
Last active December 17, 2015 05:49
Bearcart Complex Bars

Bearcart bar plot with large number of data columns.

@wrobstory
wrobstory / README.md
Last active November 4, 2018 14:21
Folium Choropleth

A choropleth map created with Folium and Pandas. Pull data into a dataframe, bind to a feature of the GeoJSON, map it. Folium allows you to specify any of the color brewer sequential color groups, and also allows you to specify the d3 quantize scale range:

import folium
import json
import pandas as pd
import vincent

county_data = r'us_county_data.csv'
county_geo = r'us-counties.json'
@wrobstory
wrobstory / README.md
Last active February 10, 2020 00:57
Folium Simple Markers

A Leaflet.js map created with Folium. This map was generated with the following Python code:

import folium

map_1 = folium.Map(location=[45.372, -121.6972], zoom_start=12,
                   tiles='Stamen Terrain')
map_1.simple_marker([45.3288, -121.6625], popup='Mt. Hood Meadows')
map_1.simple_marker([45.3311, -121.7113], popup='Timberline Lodge')
map_1.create_map(path='mthood.html')
@wrobstory
wrobstory / README.md
Last active December 23, 2017 10:41
Folium Circle Markers

A Leaflet.js map created with Folium- click on the marker to see the popup text. This map was generated with the following Python code:

map_2 = folium.Map(location=[45.5236, -122.6750], tiles='Stamen Toner',
                   zoom_start=13)
map_2.simple_marker(location=[45.5244, -122.6699], popup='The Waterfront')
map_2.circle_marker(location=[45.5215, -122.6261], radius=500,
                    popup='Laurelhurst Park', line_color='#3186cc',
                    fill_color='#3186cc')
map_2.create_map(path='portland.html')
@wrobstory
wrobstory / README.md
Last active December 17, 2015 12:29
Folium Lat/Lng Popover

A Leaflet.js map created with Folium- click on the map to see Lat/Lng popovers. This map was generated with the following Python code:

map_3 = folium.Map(location=[46.1991, -122.1889], tiles='Stamen Terrain',
                   zoom_start=13)
map_3.lat_lng_popover()
map_3.create_map(path='sthelens.html')
@wrobstory
wrobstory / README.md
Last active August 29, 2022 07:07
Folium Click-for-marker

A Leaflet.js map created with Folium- click on the map to add markers, double-click to remove them. This map was generated with the following Python code:

map_4 = folium.Map(location=[46.8527, -121.7649], tiles='Stamen Terrain',
                   zoom_start=13)
map_4.simple_marker(location=[46.8354, -121.7325], popup='Camp Muir')
map_4.click_for_marker(popup='Waypoint')
map_4.create_map(path='mtrainier.html')
@wrobstory
wrobstory / README.md
Last active December 17, 2015 12:29
Folium Polygon Markers

A Leaflet.js map created with Folium. This map was generated with the following Python code:

map_5 = folium.Map(location=[45.5236, -122.6750], zoom_start=13)
map_5.polygon_marker(location=[45.5012, -122.6655], popup='Ross Island Bridge',
                     fill_color='#132b5e', num_sides=3, radius=10)
map_5.polygon_marker(location=[45.5132, -122.6708], popup='Hawthorne Bridge',
                     fill_color='#45647d', num_sides=4, radius=10)
map_5.polygon_marker(location=[45.5275, -122.6692], popup='Steel Bridge',
 fill_color='#769d96', num_sides=6, radius=10)
@wrobstory
wrobstory / NOAA_46041.csv
Last active December 17, 2015 12:29
Folium Vincent/Vega Markers
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 11 columns, instead of 9 in line 8.
station_id,latitude (degrees north),longitude (degrees east),date_time,air_temperature (C°),sea_level_pressure (hPa),wind_speed (m/s),gust_speed (m/s),significant_wave_height (m),dominant_wave_period (s),sea_surface_temperature (C°) 2868187,47.34899902,-124.7080002,2013-04-18T00:50:00Z,7.199999809,1032.599976,5,8,1,8,10.10000038 2868187,47.34899902,-124.7080002,2013-04-18T01:50:00Z,6.800000191,1032.300049,4,5,1.100000024,6,10 2868187,47.34899902,-124.7080002,2013-04-18T02:50:00Z,6.900000095,1031.800049,3,4,1.100000024,7,10 2868187,47.34899902,-124.7080002,2013-04-18T03:50:00Z,7,1031.699951,2,3,1,6,9.899999619 2868187,47.34899902,-124.7080002,2013-04-18T04:50:00Z,7.099999905,1031.900024,1,2,0.899999976,8,9.899999619 2868187,47.34899902,-124.7080002,2013-04-18T05:50:00Z,7.199999809,1031.699951,0,1,0.899999976,6,9.800000191 2868187,47.34899902,-124.7080002,2013-04-18T06:50:00Z,7.400000095,1031.400024,3,3,0.899999976,6,9.800000191 2868187,47.34899902,-124.7080002,2013-04-18T07:50:00Z,7.400000095,1031.300049,2,3,0
@wrobstory
wrobstory / README.md
Last active December 17, 2015 12:29
Folium Geo/TopoJSON Overlay

A Leaflet.js map created with Folium using both GeoJSON and TopoJSON. The map was generated with the following Python code:

geo_path = r'data/antarctic_ice_edge.json'
topo_path = r'data/antarctic_ice_shelf_topo.json'

ice_map = folium.Map(location=[-59.1759, -11.6016],
                     tiles='Mapbox Bright', zoom_start=2)
ice_map.geo_json(geo_path=geo_path)
ice_map.geo_json(geo_path=topo_path, topojson='objects.antarctic_ice_shelf')