Skip to content

Instantly share code, notes, and snippets.

@madams1
Last active October 10, 2015 00:20
Show Gist options
  • Save madams1/56c685c4e5c3eb41b999 to your computer and use it in GitHub Desktop.
Save madams1/56c685c4e5c3eb41b999 to your computer and use it in GitHub Desktop.
simple Kernel Density Estimation
<!DOCTYPE html>
<html>
<head>
<title>Kernel Density Estimation</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,300,600,800' rel='stylesheet' type='text/css'>
<style>
.density-chart {
font: 10px 'Open Sans', sans-serif;
}
p {
font-family: 'Open Sans', sans-serif;
}
.density-rule {
stroke: #000;
stroke-width: 0.5;
}
.density-original {
stroke: #000;
stroke-width: 1.3px;
fill: #eee;
}
.density-filled {
stroke: none;
fill: none;
}
.density-xaxis path, .density-xaxis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
.density-axis-label {
font-weight: 600;
}
</style>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<script type="text/javascript" src="//rawgithub.com/madams1/density.js/master/assets/scripts/science.v1.min.js"></script>
<script type="text/javascript" src="//rawgithub.com/madams1/density.js/master/density.min.js"></script>
</head>
<body>
<script type="text/javascript">
density("https://raw.githubusercontent.com/madams1/density.js/master/examples/faithful.json")
.width(800)
.height(400)
.fill("steelblue")
.axisLabel("Minutes Between Eruptions");
</script>
<p>
<a href="https://github.com/madams1/density.js">
https://github.com/madams1/density.js
</a>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment