Skip to content

Trellis Plot

4 messages · Paul Hiemstra, Walmes Zeviani, ychu066

#
ychu066 wrote:
see panel.text()

cheers,
Paul
#
You could try adapt this code:

yy <- c(rnorm(20,2),rnorm(35,3),
rnorm(30,2),rnorm(20,3),rnorm(4,2),rnorm(10,3))
xx <- c(1:20,1:35,1:30,1:20,1:4,1:10)
gg <- rep(c('A','B','A','B','A','B'), c(20,35,30,20,4,10))
pp <- rep(c('Cond 1','Cond 2','Cond 3'), c(55, 50, 14))

#pdf("teste.pdf")
xyplot(yy ~ xx | pp, groups=gg)
 trellis.focus('strip', 1, 1, highlight=FALSE)
  ltext(0, .5, '20', col='red', pos=4)
  ltext(1, .5, '35', col='black', pos=2)
 trellis.unfocus()
 trellis.focus('strip', 2, 1, highlight=FALSE)
  ltext(0,.5,'30',col='red', pos=4)
  ltext(1,.5,'20',col='black', pos=2)
 trellis.unfocus()
 trellis.focus('strip', 1, 2, highlight=FALSE)
  ltext(0,.5,'4',col='red', pos=4)
  ltext(1,.5,'10',col='black', pos=2)
 trellis.unfocus()
#dev.off()

Walmes Zeviani, Brasil.
ychu066 wrote:

  
    
#
i was trying to do a for loop for plotting the histograms , but it doesnt
work properly
+ {   
+   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
I am not sure what was happeneing. . . can anyone help me ?
ychu066 wrote: