# [R] lattice histogram finetuning

Patrick Kuss Patrick.Kuss at unibas.ch
Tue Jan 31 11:10:02 CET 2006

```Dear list,

I have some difficulties fine-tuning a lattice conditional histogram plot and
found little help in the documentation.
My dataset consists of plant flowering ages from 3 different altitudes and 3
successional sites at each altitudinal level.

My questions are:

How do I avoid that lattice automatically sorts the different \$condlevels
alphabetically? I need:
hist\$condlevels\$succession <- list("early","mid","late")
# not "early","late","mid"
hist\$condlevels\$site <- list("FU","SP","JU")

Additionally, how do I add a vertical line indicating the mean flowering age at
each panel?

And how do I assure breaks to happen for each year?
hist\$panel.args.common\$breaks

Happy for any suggestions

Patrick

# Flowering age at different altitudes and successional site

FU.e <- round(rnorm(20,mean=9,sd=1),dig=0)
FU.m <- round(rnorm(20,mean=12,sd=1),dig=0)
FU.l <- round(rnorm(20,mean=15,sd=1),dig=0)
SP.e <- round(rnorm(20,mean=8,sd=1),dig=0)
SP.m <- round(rnorm(20,mean=11,sd=1),dig=0)
SP.l <- round(rnorm(20,mean=14,sd=1),dig=0)
JU.e <- round(rnorm(20,mean=7,sd=1),dig=0)
JU.m <- round(rnorm(20,mean=10,sd=1),dig=0)
JU.l <- round(rnorm(20,mean=13,sd=1),dig=0)

age <- c(FU.e,FU.m,FU.l,SP.e,SP.m,SP.l,JU.e,JU.m,JU.l)
site <- rep(c("FU","SP","JU"),each=60)
succession <- rep(c("early","mid","late"),each=20,times=3)

CT.flow <- data.frame(site,succession,age)

library(lattice)
trellis.device(color=F)

hist <- histogram(~age|succession*site,data=CT.flow)
hist

--
Patrick Kuss
PhD-student
Institute of Botany
University of Basel
Schönbeinstr. 6
CH-4056 Basel
+41 61 267 2976

```