Skip to content

Instantly share code, notes, and snippets.

View markmarkoh's full-sized avatar

Mark DiMarco markmarkoh

View GitHub Profile
@markmarkoh
markmarkoh / code.R
Last active December 24, 2015 03:09 — forked from ramnathv/code.R
# read data and replace dots in names with underscores
obesity = read.csv(
'http://www.stat.berkeley.edu/classes/s133/data/obesity.csv',
stringsAsFactors = F
)
names(obesity) = gsub("\\.", "_", names(obesity))
# add column with two letter state names and
obesity = plyr::mutate(obesity,
State = str_trim(State),
@markmarkoh
markmarkoh / index.html
Last active December 24, 2015 03:19 — forked from ramnathv/index.html
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://d3js.org/topojson.v1.min.js' type='text/javascript'></script>
<script src='http://datamaps.github.io/scripts/datamaps.all.min.js' type='text/javascript'></script>
<style>
@markmarkoh
markmarkoh / index.html
Last active May 15, 2019 23:48 — forked from mbostock/.block
Animated line graph ( curtain approach )
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
margin: 0;
}
path.line {
<script id='popup-template' type='text/x-handlebars-template'>
{{{ popup_template }}}
</script>
<script>
var chartParams = {{{ chartParams }}}
chartParams.element = document.getElementById('{{chartId}}')
{{# popup_template }}
var tmplFn = Handlebars.compile(
document.getElementById("popup-template").innerHTML.replace(/\"#!(.*?)!#\"/g, "\\$1")
@markmarkoh
markmarkoh / index.html
Last active August 29, 2015 13:59 — forked from pachevalier/datamaps.html
Datamaps with custom data and custom projection
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="http://datamaps.github.io/scripts/datamaps.none.min.js"></script>
<div id="container" style="position: relative; width: 500px; height: 300px;"></div>
<script>
@markmarkoh
markmarkoh / README.md
Last active August 29, 2015 14:02 — forked from markmarkoh/README.md
Centering bubbles with custom map data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@markmarkoh
markmarkoh / README.md
Last active March 15, 2016 16:10 — forked from efekarakus/README.md
Find Peaks

This example illustrates how to use the findPeaks API. You can download the library from https://github.com/efekarakus/d3-peaks.

The algorithm is based on "Improved peak detection in mass spectrum by incorporating continuous wavelet transform-based pattern matching" by Pan Du, Warren A. Kibbe and Simon M. Lin. The paper can be found here.

@markmarkoh
markmarkoh / README.md
Last active May 14, 2018 13:37 — forked from jefffriesen/README.md
US Zip Codes

This is a d3.js visualization of US zip codes.

Original zip code dataset from Geocommons.

5MB shapefile with properties such as zipcode, state, name, population, area, more.

http://geocommons.com/overlays/54893 (Thank you Bill Greer)

This converts it nicely: