Hello, a probably rather stupid question to which I can't find an answer: I have a bar chart, and I want to present which bars are significantly different by placing a line with an asterisk above then (similarly to fig. 3 in: http://jnm.snmjournals.org/content/46/4/574.figures-only). Does anyone have a reference where can I find some instructions how to learn this? Thanks a lot! Omer -- View this message in context: http://r.789695.n4.nabble.com/Showing-which-bars-in-a-bar-chart-are-significantly-different-tp3649897p3649897.html Sent from the R help mailing list archive at Nabble.com.
Showing which bars in a bar chart are significantly different
5 messages · omernevo, Sarah Goslee, Joshua Wiley +1 more
I'd do it by hand with either segments() or arrows() and text(), but without a reproducible example I can't give you specific instructions. Sarah
On Wed, Jul 6, 2011 at 4:37 PM, omernevo <nevo84 at gmail.com> wrote:
Hello, a probably rather stupid question to which I can't find an answer: I have a bar chart, and I want to present which bars are significantly different by placing a line with an asterisk above then (similarly to fig. 3 in: http://jnm.snmjournals.org/content/46/4/574.figures-only). Does anyone have a reference where can I find some instructions how to learn this? Thanks a lot! Omer
Sarah Goslee http://www.functionaldiversity.org
On Wed, Jul 6, 2011 at 1:37 PM, omernevo <nevo84 at gmail.com> wrote:
Hello, a probably rather stupid question to which I can't find an answer: I have a bar chart, and I want to present which bars are significantly different by placing a line with an asterisk above then (similarly to fig. 3
I would highly recommend some reading about data visualizations techniques (and while you're at it, something on significance testing). Here are two: http://www.b-eye-network.com/view/2468 http://biostat.mc.vanderbilt.edu/wiki/Main/DynamitePlots I would argue for a paradigm switch.
in: http://jnm.snmjournals.org/content/46/4/574.figures-only). Does anyone have a reference where can I find some instructions how to learn this?
I don't know of an automated way off hand. But, if you assign the results of barplot() (I am assuming you are using traditional graphics), tmp <- barplot(rnorm(20)) tmp # has the locations on the x axis for each bar now you could go to town with lines() (see ?lines for documentation) to get those bracket thingies and text() to add the asterisks and labels. Alternately, you could add asterisks and such just using points() points(x, y, pch = "*") where x and y are the coordinates where you want the * placed. Good luck, Josh
Thanks a lot! Omer -- View this message in context: http://r.789695.n4.nabble.com/Showing-which-bars-in-a-bar-chart-are-significantly-different-tp3649897p3649897.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ 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.
Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles https://joshuawiley.com/
# Incremental approach bb <- c(23, 45, 67) bsp <- barplot(bb,beside=TRUE) # get midpoints of the bars and plot # draw lines segments( .7, 50, 1.9, 50) segments(.7, 50, .7, 48) segments(1.9, 50, 1.9, 48) # Or all in one go segments(c(.7, .7, 1.9), c(50,50,50), c(1.9,.7,1.9), c(50, 48, 48))
--- On Wed, 7/6/11, omernevo <nevo84 at gmail.com> wrote:
From: omernevo <nevo84 at gmail.com> Subject: [R] Showing which bars in a bar chart are significantly different To: r-help at r-project.org Received: Wednesday, July 6, 2011, 4:37 PM Hello, a probably rather stupid question to which I can't find an answer: I have a bar chart, and I want to present which bars are significantly different by placing a line with an asterisk above then (similarly to fig. 3 in: http://jnm.snmjournals.org/content/46/4/574.figures-only). Does anyone have a reference where can I find some instructions how to learn this? Thanks a lot! Omer -- View this message in context: http://r.789695.n4.nabble.com/Showing-which-bars-in-a-bar-chart-are-significantly-different-tp3649897p3649897.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ 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.
Thanks all! I will try this later on today... Omer -- View this message in context: http://r.789695.n4.nabble.com/Showing-which-bars-in-a-bar-chart-are-significantly-different-tp3649897p3650765.html Sent from the R help mailing list archive at Nabble.com.