[R] Ploting Histogram with Y axis is percentage of sample for each bin

David Winsemius dwinsemius at comcast.net
Thu Mar 3 23:36:24 CET 2011


On Mar 3, 2011, at 12:44 PM, leinwand wrote:

> I'm trying to do something very simple...
>
> I wan to plot a histogram where the y axis represent the percentage  
> of the
> total sample that each bin represents.
>
> I know how to plot a histogram with the counts and density... but  
> can't find
> anything that gives me perenct of sample on the y axis.
>
> Any help is appriciated
>
> Below is the script I'm working with
>
> par(mfrow=c(1,2))
> hist(ISIS$ASH_BA1K_ISIS[ISIS$Pest_Status=="-1"], main="Ash BA 1K  
> Negative
> Detection",  xlab="ASH BA 1K")
> lines(density(ISIS$ASH_BA1K_ISIS), col="blue")
> hist(ISIS$ASH_BA1K_ISIS[ISIS$Pest_Status=="1"], main="Ash BA 1K  
> Positive
> Detection", xlab="Ash BA 1K")
> lines(density(ISIS$ASH_BA1K_ISIS), col="red")

Script but no data.

There is a pretty much identical question asked and answered earlier  
today... despite the fact theat the OP doesn't seem to undersatnd or  
be able to apply the directions, you should see if the thread  
"Probabilities greather than 1 in HIST" answers your question.

>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Ploting-Histogram-with-Y-axis-is-percentage-of-sample-for-each-bin-tp3333961p3333961.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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list