[ Launch: Weather stations pseudo heatmap (using topoJSON; colored by Voronoi; simplified land shapes; showing variability) ] 5407618 by poezn
[ Launch: Weather stations pseudo heatmap (using topoJSON) ] 5130752 by poezn
[ Launch: Weather stations pseudo heatmap (using topoJSON) ] 4759487 by poezn
[ Launch: Weather stations pseudo heatmap ] 4758743 by poezn
[ Launch: Weather stations pseudo heatmap ] 4746489 by poezn
[ Launch: Weather stations pseudo heatmap ] 4744710 by poezn
[ Launch: Weather stations ] 4743404 by poezn
-
-
Save poezn/5407618 to your computer and use it in GitHub Desktop.
Weather stations density hexbins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"Weather stations density hexbins","endpoint":"","display":"canvas","public":true,"require":[{"name":"TopoJSON","url":"http://d3js.org/topojson.v0.min.js"},{"name":"TopoJSON","url":"http://d3js.org/topojson.v0.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"stations.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"countries.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"stations_1910.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"countries_simplified.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"hexbins.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var r = 5, | |
month = Math.floor(37) % 12 + 1; // 1 = January, 12 = December | |
var projection = d3.geo.equirectangular() | |
.center([0,0]) | |
.scale(145) | |
var c = tb.ctx; | |
var path = d3.geo.path() | |
.projection(projection) | |
.context(c); | |
var world = tb['countries_simplified']; | |
var countries = topojson.object(world, world.objects.world); | |
c.fillStyle = "#181730"; | |
c.rect(0,0, 1000, 800) | |
c.fill() | |
// clipping path | |
c.beginPath(); | |
path(countries); | |
c.closePath(); | |
c.clip(); | |
var data_hexbins = tb["hexbins"]; | |
var colorScaleHex = d3.scale.linear() | |
.domain([0, d3.max(data_hexbins.features, function(d, i) { return d.properties.COUNT })]) | |
.range(["#F3FFE6", "#3BB945"]) | |
// clipping path | |
_.each(data_hexbins.features, function(d, i) { | |
c.beginPath(); | |
path(d); | |
c.closePath(); | |
c.fillStyle = colorScaleHex(d.properties.COUNT); | |
c.fill() | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment