
Violin plots

sjr51
An example is here in matplotlib
http://pyinsci.blogspot.co.uk/2009/09/violin-plot-with-matplotlib.html
Unless I'm missing something, I can't see an implementation in IgorPro.
My initial thought to do this is: make a histogram from each 1D wave, smooth, make a copy, multiply one version by 0.5 and the other by -0.5. There are several problems with this: dealing with multiple waves will be difficult, it will be in the wrong orientation, smoothing needs to be done relative to bin size (I think). I wondered if anyone has tackled this already? Perhaps as part of implementing the Scatter Dot Plot graphing package?
The original reference for Violin Plots is Hintze & Nelson (1998) The American Statistician 52(2):181-4.
Be sure to use axis coordinates with SetDrawEnv.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
November 24, 2014 at 08:32 am - Permalink
AppendToGraph/VERT
to make it stand on its head.John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
November 26, 2014 at 09:20 am - Permalink
Edit: in case anyone is following this thread. I have found a very nice kernel density estimation on IgorExchange written by bech http://www.igorexchange.com/node/4749 I'll try and work up a solution to this and will post if I get something that will be useful to others.
November 30, 2014 at 11:43 pm - Permalink
Attached are two images showing my violin plots overlaid on violin plots from R. The data are oldfaithful$waiting and oldfaithful$eruptions. My plots are in orange/red and the R plots are in black/blue. I've scaled them so you can see the difference between them. I know that I've not trimmed my violins yet.
My problem is the smoothing parameter (the standard deviation of the kernels that are summed to give the KDE). I calculate this using Silverman's rule of thumb: h= (4/3n)^1/5 * sigma. This is what R is using as the optimum smoothing parameter. Plugging this into my code (variable bw, below), I have to use h*sqrt(2) in the /WDTH flag of FastGaussTransform. This gives an "undersmoothed" violin. I can't figure out where the discrepancy comes from. FastGaussTransform definitely uses /WDTH correctly and I can't find a problem with the /RX flag (although bech's code notes that this may need attention). For the oldfaithful$waiting data if I use bw=10 in my code, Igor produces a violin that looks like the "real thing", whereas the optimum is 6.6, i.e. 4.7*sqrt(2). Any help would be much appreciated!
December 5, 2014 at 12:15 am - Permalink
UPDATE: code for violin plots is on code snippets http://www.igorexchange.com/node/6181
December 16, 2014 at 03:07 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
December 16, 2014 at 10:00 am - Permalink
A.G.
WaveMetrics, Inc.
December 16, 2014 at 01:42 pm - Permalink