Showing which bars in a bar chart are significantly different

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Showing which bars in a bar chart are significantly different

omernevo
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
Reply | Threaded
Open this post in threaded view
|

Re: Showing which bars in a bar chart are significantly different

Sarah Goslee
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 <[hidden email]> 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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Showing which bars in a bar chart are significantly different

Joshua Wiley-2
In reply to this post by omernevo
On Wed, Jul 6, 2011 at 1:37 PM, omernevo <[hidden email]> 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.
>
> ______________________________________________
> [hidden email] 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/

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Showing which bars in a bar chart are significantly different

John Kane-2
In reply to this post by omernevo
# 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 <[hidden email]> wrote:

> From: omernevo <[hidden email]>
> Subject: [R] Showing which bars in a bar chart are significantly different
> To: [hidden email]
> 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.
>
> ______________________________________________
> [hidden email]
> 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Showing which bars in a bar chart are significantly different

omernevo
Thanks all!

I will try this later on today...

Omer