Mike White wrote: > I am having difficulty setting different xlim values in the lattice > histogram plot function. > An example is shown below. I think I need to convert the limits data.frame > to a list of paired values but don't know how. Any help would be > appreciated. > > library(lattice) > mat <- as.data.frame(matrix(abs(c(rnorm(100), > 10*rnorm(100),20*rnorm(100),30*rnorm(100))),ncol=4)) > colnames(mat)<-c("C1","C2","C3","C4") > mat2<-stack(mat) > > limits<-cbind(rep(0, ncol(mat)),apply(mat,2,max)) > histogram(~ values | ind, data=mat2, xlim=limits, > scales=list(x=list(relation="free"))) > > Thanks > Mike White >
I think you want a breaks=NULL in your call to histogram: library(lattice) set.seed(42) mat <- data.frame(C1 = abs(rnorm(100)), C2 = abs(10 * rnorm(100)), C3 = abs(20 * rnorm(100)), C4 = abs(30 * rnorm(100))) mat2 <- stack(mat) histogram(~ values | ind, data = mat2, breaks = NULL, scales = list(x = list(relation = "free"))) HTH, --sundar ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html