d3.histogram()function, not using a kernel density estimate.
thresholdsargument of the
d3.histogram()function. It is advised to try different bin size.
paddingargument of the x axis to control space between violin.
It is important to understand that in the violin chart above the smoothing effect is due to a curve interpolation between bins. Here is the result without any interpolation (left) and using a
curveStep interpolation (right). Just change the
.curve() call in the code above to get these results.