[R] Showing which bars in a bar chart are significantly different
jwiley.psych at gmail.com
Wed Jul 6 22:55:03 CEST 2011
On Wed, Jul 6, 2011 at 1:37 PM, omernevo <nevo84 at gmail.com> wrote:
> 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:
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
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
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(x, y, pch = "*")
where x and y are the coordinates where you want the * placed.
> Thanks a lot!
> 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
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Ph.D. Student, Health Psychology
University of California, Los Angeles
More information about the R-help