Question: violinplot procedure

I created a quick procedure to produce a violin plot and I would like some help to make it better. 

I would like it to show a more accurate distribution of the data, I interpert the graph as the data having negative values which of course there is none.  How can we fix that? I realize we can just set the range=min(data)..max(data) but then I loose the violin tips and I would need to place a line to cap the top and bottom.

So how can we create a violin plot with the tips at the extents? and Using the range, how do I define the x bounds for the lines to cap the violin plot? 

 

violinplot := proc (data) local a, b, c; a := Statistics:-KernelDensityPlot(data); b := plottools:-reflect(a, [[0, 0], [1, 0]]); c := plots:-display(a, b, axes = box); plots:-display(plottools:-rotate(c, (1/2)*Pi)) end proc:

b := [45, 7, 4, 345, 8, 456, 3, 2, 45, 444, 111, 34]

[45, 7, 4, 345, 8, 456, 3, 2, 45, 444, 111, 34]

(1)

violinplot(b)

 

``

 

Download violinplot_proc.mw

Please Wait...