Bar Graph

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

Bar Graph

AbouEl-Makarim Aboueissa-3
Dear All:


I do need your help on how to add frequency to bar plot on the top of each
bar.


here is the R code.


*Number.of.Death <- c(432, 217,93, 34, 224)    ##### Number of Death*

*Cause.of.Death <- c("Heart disease", "Cancer", "Stroke", "Accidents",
"Other")  *

*barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar Grapg for
Death Data", ylab="Number of Death", xlab="Cause of Death") *



Thank you very much for your help in advance.


with many thanks
abou
______________________


*AbouEl-Makarim Aboueissa, PhD*

*Professor of Statistics*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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: Bar Graph

Rui Barradas
Hello,

Use function text() with the return of barplot() as x value and
Number.of.Death as y.
Note that the limits of the y axis are not the automatic ones.



bp <- barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar Graph for
Death Data", ylab="Number of Death", xlab="Cause of Death", ylim = c(0,
500))

text(x = bp, y = Number.of.Death, labels = Number.of.Death, pos = 3)


Hope this helps,

Rui Barradas

On 11-09-2018 19:02, AbouEl-Makarim Aboueissa wrote:

> Dear All:
>
>
> I do need your help on how to add frequency to bar plot on the top of each
> bar.
>
>
> here is the R code.
>
>
> *Number.of.Death <- c(432, 217,93, 34, 224)    ##### Number of Death*
>
> *Cause.of.Death <- c("Heart disease", "Cancer", "Stroke", "Accidents",
> "Other")  *
>
> *barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar Grapg for
> Death Data", ylab="Number of Death", xlab="Cause of Death") *
>
>
>
> Thank you very much for your help in advance.
>
>
> with many thanks
> abou
> ______________________
>
>
> *AbouEl-Makarim Aboueissa, PhD*
>
> *Professor of Statistics*
> *Graduate Coordinator*
>
> *Department of Mathematics and Statistics*
> *University of Southern Maine*
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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: Bar Graph

Bert Gunter-2
In reply to this post by AbouEl-Makarim Aboueissa-3
Not quite -- he wanted the frequencies not the counts. So something
like this (using the adj argument to center the frequencies above each
bar:

bp <-barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar
Graph for Death Data", ylab="Number of Deaths", xlab="Cause of Death",
ylim = c(0,500) )

text(bp, y = Number.of.Death + 30, adj = .5,
     lab = round(Number.of.Death/sum(Number.of.Death),2))

Cheers,
Bert

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Tue, Sep 11, 2018 at 11:02 AM AbouEl-Makarim Aboueissa
<[hidden email]> wrote:

>
> Dear All:
>
>
> I do need your help on how to add frequency to bar plot on the top of each
> bar.
>
>
> here is the R code.
>
>
> *Number.of.Death <- c(432, 217,93, 34, 224)    ##### Number of Death*
>
> *Cause.of.Death <- c("Heart disease", "Cancer", "Stroke", "Accidents",
> "Other")  *
>
> *barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar Grapg for
> Death Data", ylab="Number of Death", xlab="Cause of Death") *
>
>
>
> Thank you very much for your help in advance.
>
>
> with many thanks
> abou
> ______________________
>
>
> *AbouEl-Makarim Aboueissa, PhD*
>
> *Professor of Statistics*
> *Graduate Coordinator*
>
> *Department of Mathematics and Statistics*
> *University of Southern Maine*
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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: Bar Graph

AbouEl-Makarim Aboueissa-3
Dear Bert:

thank you very much

abou
______________________


*AbouEl-Makarim Aboueissa, PhD*

*Professor of Statistics*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*



On Tue, Sep 11, 2018 at 2:47 PM Bert Gunter <[hidden email]> wrote:

> Not quite -- he wanted the frequencies not the counts. So something
> like this (using the adj argument to center the frequencies above each
> bar:
>
> bp <-barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar
> Graph for Death Data", ylab="Number of Deaths", xlab="Cause of Death",
> ylim = c(0,500) )
>
> text(bp, y = Number.of.Death + 30, adj = .5,
>      lab = round(Number.of.Death/sum(Number.of.Death),2))
>
> Cheers,
> Bert
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
> On Tue, Sep 11, 2018 at 11:02 AM AbouEl-Makarim Aboueissa
> <[hidden email]> wrote:
> >
> > Dear All:
> >
> >
> > I do need your help on how to add frequency to bar plot on the top of
> each
> > bar.
> >
> >
> > here is the R code.
> >
> >
> > *Number.of.Death <- c(432, 217,93, 34, 224)    ##### Number of Death*
> >
> > *Cause.of.Death <- c("Heart disease", "Cancer", "Stroke", "Accidents",
> > "Other")  *
> >
> > *barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar Grapg for
> > Death Data", ylab="Number of Death", xlab="Cause of Death") *
> >
> >
> >
> > Thank you very much for your help in advance.
> >
> >
> > with many thanks
> > abou
> > ______________________
> >
> >
> > *AbouEl-Makarim Aboueissa, PhD*
> >
> > *Professor of Statistics*
> > *Graduate Coordinator*
> >
> > *Department of Mathematics and Statistics*
> > *University of Southern Maine*
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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: Bar Graph

AbouEl-Makarim Aboueissa-3
In reply to this post by Rui Barradas
Dear  Rui:

thank you very much

abou
______________________


*AbouEl-Makarim Aboueissa, PhD*

*Professor of Statistics*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*



On Tue, Sep 11, 2018 at 2:24 PM Rui Barradas <[hidden email]> wrote:

> Hello,
>
> Use function text() with the return of barplot() as x value and
> Number.of.Death as y.
> Note that the limits of the y axis are not the automatic ones.
>
>
>
> bp <- barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar Graph
> for
> Death Data", ylab="Number of Death", xlab="Cause of Death", ylim = c(0,
> 500))
>
> text(x = bp, y = Number.of.Death, labels = Number.of.Death, pos = 3)
>
>
> Hope this helps,
>
> Rui Barradas
>
> On 11-09-2018 19:02, AbouEl-Makarim Aboueissa wrote:
> > Dear All:
> >
> >
> > I do need your help on how to add frequency to bar plot on the top of
> each
> > bar.
> >
> >
> > here is the R code.
> >
> >
> > *Number.of.Death <- c(432, 217,93, 34, 224)    ##### Number of Death*
> >
> > *Cause.of.Death <- c("Heart disease", "Cancer", "Stroke", "Accidents",
> > "Other")  *
> >
> > *barplot(Number.of.Death, names.arg=Cause.of.Death, main="Bar Grapg for
> > Death Data", ylab="Number of Death", xlab="Cause of Death") *
> >
> >
> >
> > Thank you very much for your help in advance.
> >
> >
> > with many thanks
> > abou
> > ______________________
> >
> >
> > *AbouEl-Makarim Aboueissa, PhD*
> >
> > *Professor of Statistics*
> > *Graduate Coordinator*
> >
> > *Department of Mathematics and Statistics*
> > *University of Southern Maine*
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
> >
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.