[R] histogram-like plot - multiple bars side by side
Greg Snow
Greg.Snow at imail.org
Mon Sep 29 22:13:05 CEST 2008
Do you mean something like this:
x <- 0:14
y1 <- dbinom(x,14,0.7)
y2 <- dbinom(x,14,0.5)
y3 <- dbinom(x,14,0.3)
barplot( rbind(y1,y2,y3), names=x, beside=TRUE)
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Jörg Groß
> Sent: Monday, September 29, 2008 2:06 PM
> To: r-help at r-project.org
> Subject: [R] histogram-like plot - multiple bars side by side
>
> Hi,
>
> I found this example for producing multiple histograms;
>
> require(plotrix)
> l <- list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3))
> multhist(l)
>
>
> Now I want something like that, for creating multiple density
> distributions (in one plot).
>
> But I have two variables for one density distribution and "multhist"
> only allows me to add one variable;
> x <- seq(from=0, to=14, by=1)
> y <- dbinom(x, 14, 0.7, log = FALSE)
>
>
> Is there a way to make a histogram-like plot with multiple bars side
> by side (for different distributions) like in the example?
>
> ______________________________________________
> 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.
More information about the R-help
mailing list