Plot Points

Plot points on a 2D graph. See example below:

Example code

var graph = new Graph({
	appendTo : "container",
	canvasWidth : 800,
	canvasHeight : 800/Math.sqrt(2),
	title : "Box Müller",
	xAxisTitle : "x",
	yAxisTitle : "y"
});

var px = [], py = [];

for (var i = 0; i < 1000; i++) {
	r = Math.random();
	s = Math.random();
	py.push(Math.sqrt(-2*Math.log(1-r))*Math.cos(Math.PI*2*s));
	px.push(Math.sqrt(-2*Math.log(1-r))*Math.sin(Math.PI*2*s));
}

graph.points(py, px);