Skip to content

Instantly share code, notes, and snippets.

@DeBraid
Created November 17, 2013 17:39
Show Gist options
  • Save DeBraid/7515910 to your computer and use it in GitHub Desktop.
Save DeBraid/7515910 to your computer and use it in GitHub Desktop.
simple scatterplot
{"description":"simple scatterplot","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"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}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/9zG4xKC.png"}
var svg = d3.select("svg");
var data = [42, 14, 67, 55, 33, 11, 77, 34, 23, 12, 13];
var groups = svg.selectAll("g")
.data(data)
.enter()
.append("g");
var circles = groups.append("circle")
.attr({
cx: function(d,i) {
return (i+1)*48;
},
cy: function(d,i) {
return d*5.56;
},
r: 20,
fill: "tomato",
stroke: "brown",
"stroke-width": 4,
"stroke-opacity": 0.5
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment