Skip to content

Instantly share code, notes, and snippets.

@pcarleton
pcarleton / README.md
Last active November 2, 2015 05:16
clojurescript, d3, and react for visualizing orbital eccentricities

This is an example of using ClojureScript reactjs (via Reagent) and d3 to experiment with orbital eccentricities of several bodies in the solar system.

@pcarleton
pcarleton / README.md
Last active October 23, 2019 22:48
Moon Phase

This is an example of using D3's orthograph projections to visualize moon phases. My starting point for this was http://bl.ocks.org/mbostock/3795040.

GeoJSON

There is a nice geojson wsyiwig editor here: http://geojson.io/#map=1/16/-68.

When defining points, the first value is the angle in degrees from the prime meridian (-180, 180). The second is the angle in degrees from the equator [-90, 90]. So, any value [x, 90] is at the North pole, and any value [x, -90] is at the south pole. I was getting some funkiness when I put things directly on the poles, so I fudged it a little bit and went with 89.5.

You can read hemisphere.json like this:

var lanesChart = function() {
var margin = {top: 20, right: 2, bottom: 15, left: 120},
width = 960,
height = 600,
miniLaneHeight = 8,
xMiniScale = d3.time.scale(),
yMiniScale = d3.scale.linear(),
xMainScale = d3.time.scale(),