Skip to content

Instantly share code, notes, and snippets.

@Andrew-Reid
Last active May 31, 2017 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrew-Reid/61f0b6f4d511ea7fc2a082a5279484d7 to your computer and use it in GitHub Desktop.
Save Andrew-Reid/61f0b6f4d511ea7fc2a082a5279484d7 to your computer and use it in GitHub Desktop.
US Albers
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960;
var height = 500;
var svg = d3.select("body").append("svg")
.attr("width",width)
.attr("height",height);
var projection = d3.geo.albersUsa().translate([width/2,height/2]);
var path = d3.geo.path().projection(projection);
d3.json("us.json",function(data) {
svg.append("path")
.datum(data)
.attr('d',path)
.attr('fill','steelblue')
.attr('stroke','black');
});
</script>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment