[R] Trellis Plot

ychu066 ychu066 at aucklanduni.ac.nz
Wed Nov 25 02:00:21 CET 2009


i was trying to do a for loop for plotting the histograms , but it doesnt
work properly 

> library(lattice) 
> columns <- 8:153 
> plots <- vector("list", length(columns)) 
> j <- 0 
> for (i in columns) 
+ {   
+   plots[[ j <- j+1 ]] <- histogram( ~ data[,i] | data[,2],ylab =
"Frequency", 
+   xlab = "Score", xlim = c(1,5), ylim = c(0,100),layout=c(3,1), 
+   main = c(colnames(data)[i],"index",j+1),mycolors =
colors()[c(536,552,652,254,26)], 
+   panel = function(..., col, mycolors) { 
+   panel.histogram(..., col = mycolors[panel.number()])}) 
+ trellis.focus('strip', 1, 1, highlight=FALSE)
+ ltext(0.60, -0.25, 'PPM', col='blue', pos=3)
+ trellis.unfocus()
+ }   
Error in grid.Call.graphics("L_downviewport", name$name, strict) : 
  Viewport 'plot1.strip.1.1.vp' was not found
>         
> print(plots[[1]])


I am not sure what was happeneing. . . can anyone help me ?


ychu066 wrote:
> 
> anyone know how to add text in the Trellis plot panel ?? i want to add
> things eg: dot dot dot. in the headrer of the panel.
> 
> eg:  http://old.nabble.com/file/p26486579/hist1.png hist1.png 
> 

-- 
View this message in context: http://old.nabble.com/Trellis-Plot-tp26486579p26505934.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list