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-tp26486579p26486579.html Sent from the R help mailing list archive at Nabble.com.
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 >see panel.text() cheers, Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~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:>
> 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-tp26486579p26494827.html
Sent from the R help mailing list archive at Nabble.com.
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.