问题
I am trying to plot a sorted array of normally distributed data so that it plots as straight line. I would like to do this using a cumulative density function, which I think is also known as a quantile function. Unfortunately, I haven't found many examples that use the quantile scale.
Here is my attempt to use the quantile scale: http://jsfiddle.net/tbcholla/hmFqJ/3/. I set up my x scale this way:
var x = d3.scale
.quantile()
.range(d3.range(0,width,1))//this will create an array from 0 to the width, counting by 1's.
.domain([0,simple.length]);
and drew my line this way:
var rank = 0;
var myLine = d3.svg.line().interpolate("step-before")
.x(function(d) {
rank = rank +1;
return x(rank);})
.y(function(d) {
return y(d);
});
Can anyone help explain where I am going wrong plotting the quantile scale? Can the quantile scale be used as a cumulative density function? Are there any examples of this scale in use that you could point me towards?
来源:https://stackoverflow.com/questions/17758823/plotting-a-line-graph-with-scale-quantile