Displaying 1 result from an estimated 1 matches for "mygray".
2009 Dec 20
1
How to put text outside an xyplot?
...to the right of the color key. I worked with grid.text and also viewport(), but couldn't achieve this. I know this should be simple, but I just couldn't figure out how to do it. How does this work?
Cheers,
Marius
library(lattice)
library(grid)
myvec=1:10
data=data.frame(x=myvec,y=myvec)
mygray=function(l) gray(seq(0.2,0.8,length=l))
colors=level.colors(data[1:10,2],at=do.breaks(c(1,10),10),col.regions=mygray)
colorvec=colors[1:10]
#trellis.device(postscript,color=F,horizontal=F,onefile=F)
xyplot(data[,2]~data[,1],aspect=1,
panel=function(...){
panel.xyplot(...,type="n")
lp...