RE: [R] Vaseplots

From: Liaw, Andy <>
Date: Tue 13 Jul 2004 - 05:47:34 EST

I don't have that article handy, but it sounds like `violin plots' that I've read (also in Am. Stat.) quite a while ago. I wrote a S-PLUS function to do something like it back in the dark ages. It probably isn't too hard to modify for use with R. See if it does something similar:

violin.plot<-function(y, x=NULL, ...) {

    if (is.null(x)) {

        cx <- boxplot(y,style.bxp='old')
        den.y <- ksmooth(y,ker='n')
    } else {
        if (!is.factor(x)) x<-factor(x)
        cx <- boxplot(split(y,x),style.bxp='old')
        for(i in 1:length(lev.x)) {


[Note that I had to do quite a bit of fudging to get the x-coordinates sort of right in S-PLUS. In R this is a LOT easier.]


> From: Peter Flom
> In The American Statistician vol 42 (1988) pages 257 - 280, Yoav
> Benjamini investigates some variations on the box plot, including
> vaseplots, which maek the width of each box vary proportionally to he
> estimated density at a particular point.
> Has anyone implemented these in R ?
> Thanks as always
> Peter
> mailing list PLEASE do read the posting guide! Received on Tue Jul 13 05:56:47 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:52 EST