What is the meaning of this statement?
quantize = d3.scale.quantile().domain([0, 15]).range(d3.range(9));
I saw that the domain is:
I would recommend reading over the quantile scale documentation, especially that on quantize.quantiles()
But basically, d3 sees that there are 9 values in the output range for this scale, so it creates 9 quantiles based on the 2 value data set: [0, 15].
This leads to the quantize.quantiles() values that you show in your question: [1.6, 3.3, .. ,13.3] , these represent the bounds of the quantiles - anything less than 1.6 will be mapped to the first element of the output range (in this case zero). Anything less than 3.3 and greater than 1.6 will be mapped to the second element of the output range (one). Hence quantize(2) = one, as expected.