Skip to content

Instantly share code, notes, and snippets.

View cscheid's full-sized avatar

Carlos Scheidegger cscheid

View GitHub Profile
@cscheid
cscheid / 110_admin.geojson
Last active January 18, 2020 02:51 — forked from Alex-Devoid/110_admin.geojson
A viz of all the "remain in Mexico" (MPP) asylum cases.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cscheid
cscheid / .block
Last active June 16, 2016 18:40 — forked from mbostock/.block
Cluster Dendrogram, not flipped
license: gpl-3.0
@cscheid
cscheid / README.md
Last active August 29, 2015 14:09 — forked from mbostock/.block

The scatterplot matrix visualizations pairwise correlations for multi-dimensional data; each cell in the matrix is a scatterplot. This example uses Anderson's data of iris flowers on the Gaspé Peninsula. Scatterplot matrix design invented by J. A. Hartigan; see also R and GGobi. Data on Iris flowers collected by Edgar Anderson and published by Ronald Fisher.

See also this version with brushing.

@cscheid
cscheid / README.md
Last active August 29, 2015 14:08 — forked from mbostock/.block
@cscheid
cscheid / README.md
Created March 27, 2014 17:04 — forked from mbostock/.block

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

@cscheid
cscheid / osm.R
Last active January 3, 2016 09:29 — forked from cpsievert/osm.R
setwd("~/Downloads")
obs <- XML2Obs("out.xml", url.map=TRUE)
unique(names(obs)) #you might want to re_name or add_key before collapsing
tmp = add_key(obs, parent="url1//osm//way", key.name="way_id")
tmp = add_key(tmp, parent="url1//osm//node", key.name="node_id")
tmp = add_key(tmp, parent="url1//osm//relation", key.name="relation_id")
tables <- collapse(obs) # holy crap this takes a long-ass time
write.table(tables$`url1//osm//way//nd`, "ways.csv", sep=",")
write.table(tables$`url1//osm//way//tag`, "way_tags.csv", sep=",")
write.table(tables$`url1//osm//node`, "nodes.csv", sep=",")
We can't make this file beautiful and searchable because it's too large.
Area State,Area Type,Area,City,Date,LAUS Code,State,Area FIPS Code,Employed,Labor Force,Month,State FIPS Code,Unemployed,Unemployment Rate,Year
ME,Met NECTA,Portland-South Portland-Biddeford,Portland,1/1/2000,MT237675,ME,76750,184223,189622,1,23,5399,2.8,2000
ME,Met NECTA,Bangor,Bangor,1/1/2000,MT237075,ME,70750,64191,66618,1,23,2427,3.6,2000
ME,Met NECTA,Lewiston-Auburn,Lewiston,1/1/2000,MT237465,ME,74650,52934,54950,1,23,2016,3.7,2000
MA,Met NECTA,Pittsfield,Pittsfield,1/1/2000,MT257660,MA,76600,37117,38301,1,25,1184,3.1,2000
MA,Met NECTA,Leominster-Fitchburg-Gardner,Leominster,1/1/2000,MT257450,MA,74500,71032,73398,1,25,2366,3.2,2000
MA,Met NECTA,Barnstable Town,Barnstable Town,1/1/2000,MT257090,MA,70900,121657,125999,1,25,4342,3.4,2000
MA,Met NECTA,New Bedford,New Bedford,1/1/2000,MT257555,MA,75550,79221,82833,1,25,3612,4.4,2000
MA-CT,Met NECTA,Worcester,Worcester,1/1/2000,MT257960,MA,79600,273295,281124,1,25,7829,2.8,2000
MA-CT,Met NECTA,Springfield,Springfield,1/1/2000,MT257810,MA,78100,326271,336515,1,
@cscheid
cscheid / README.md
Created November 28, 2012 18:41 — forked from mbostock/.block
Gradient Along Stroke

This example demonstrates how to create a gradient that follows a stroke. This technique is sometimes used to indicate directionality along a curved edge, such as with hierarchical edge bundling.

To start, take any SVG path element and uniformly sample points along the path using getPointAtLength. (This method can also be used for path tweening.) Then, for each segment between adjacent points, compute the miter joint via line-line intersection. Lastly fill each segment by interpolating the start and end colors, here green to red, using the normalized length t along the path. Although each segment is a constant color, there are many segments to give the appearance of a continuous gradient.

This example uses a thin stroke in addition to filling the segments. This avoids antialiasing artifacts due to most