Hi:

On Mon, Aug 23, 2010 at 9:27 AM, LCOG1 <jroll@lcog.org> wrote:

>
> Hey everyone,
>   So i cant figure this out.  when using histogram() from lattice instead
> of hist() i get what i want as far as output.  But using histogram i can
> seem to be able to figure out how to get multiple plots on the same panel.
>
> So
> par(mfrow=c(3,2))
> for (i in 1:20) hist(rnorm(100),main="",cex.axis=.8)
>
> gets me about what i want but i want to use histogram() cause it gives me
> the format i want but the identical code does not work for histogram().
>
> par(mfrow=c(3,2))
> for (i in 1:20) histogram(rnorm(100),main="",cex.axis=.8)
>

This is not the syntax to use for histogram() in the lattice package.
Risking the obvious homework theory, try this:

library(lattice)
dd <- data.frame(gp = factor(rep(paste('Group', 1:6, sep = ''), each =
100)),
                  x = rnorm(600))
histogram( ~ x | gp, data = dd)
histogram( ~ x | gp, data = dd, as.table = TRUE)

Notice how the data were constructed in the data frame. This matters. Also
observe that unlike hist(), histogram() uses a formula interface; in this
case, it reads 'generate histograms of x conditioned on groups in variable
gp, from data frame dd'.

HTH,
Dennis

>
> I thought this was simply set in par() but it doesn't seem to do any good.
> Thoughts.
>
> Thanks
> JR
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Plotting-multiple-histograms-on-same-panel-tp2335426p2335426.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

