Hi all! Writing a paper using a lot of boxplots I was asked to mark the significant differences between plotted groups using "stars on top". These stars are found freqeuntly in medical papers and printed above boxplots when there is a significant difference (usually using a bar to indicate which groups are meant if there are more then two in a plot). I was able to calculate whatever test, check the significance and depending on it to put a star (written with text-function) between two groups in a boxplot. But I was not able to make the text between two groups apear above the actual plotting region nor to draw a simple line, indicating which plots are meant. Also this solution seems to more of a hack then actual programming. Is there a better way to solve this issue? Any ideas where to look? I hope I haven been clear and thank you for your effort, S. Merz
On Mon, 2008-07-07 at 11:19 +0200, Sebastian Merz wrote:> Hi all! > > Writing a paper using a lot of boxplots I was asked to mark the > significant differences between plotted groups using "stars on > top". > > These stars are found freqeuntly in medical papers and printed > above boxplots when there is a significant difference (usually using a > bar to indicate which groups are meant if there are more then two in a > plot). > > I was able to calculate whatever test, check the significance and > depending on it to put a star (written with text-function) between > two groups in a boxplot. But I was not > able to make the text between two groups apear above the actual > plotting region nor to draw a simple line, indicating which plots are > meant. Also this solution seems to more of a hack then actual > programming. > > Is there a better way to solve this issue? Any ideas where > to look? >Hi Sebastian, If I understand you correctly, try this boxplot example: boxplot(count ~ spray, data = InsectSprays, col = "lightgray") and we'll assume that the second and third boxplots require a star: par(xpd=TRUE) yrange<-par("usr")[3:4] ypos<-yrange[2]+diff(yrange)/40 segments(2,ypos,3,ypos) text(2.5,ypos+diff(yrange)/40,"*",cex=2) par(xpd=FALSE) With a bit more effort, you could set up tests of differences, collect the significant ones and automatically call a function like the above that would stick stars above the significantly different groups. Jim
HI Sebasian, I don't think I have ever seen this type of presentation. Could you provide a reference to a journal article that uses this? It might make it easier to visualize exactly what you want. --- On Mon, 7/7/08, Sebastian Merz <sebastian.merz at web.de> wrote:> From: Sebastian Merz <sebastian.merz at web.de> > Subject: [R] indicating significant differences in boxplots > To: r-help at r-project.org > Received: Monday, July 7, 2008, 5:19 AM > Hi all! > > Writing a paper using a lot of boxplots I was asked to mark > the > significant differences between plotted groups using > "stars on > top". > > These stars are found freqeuntly in medical papers and > printed > above boxplots when there is a significant difference > (usually using a > bar to indicate which groups are meant if there are more > then two in a > plot). > > I was able to calculate whatever test, check the > significance and > depending on it to put a star (written with text-function) > between > two groups in a boxplot. But I was not > able to make the text between two groups apear above the > actual > plotting region nor to draw a simple line, indicating which > plots are > meant. Also this solution seems to more of a hack then > actual > programming. > > Is there a better way to solve this issue? Any ideas where > to look? > > I hope I haven been clear and thank you for your effort, > S. Merz > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code.