[R] newbie's question : xyplot legend with a white background

Dennis Murphy djmuser at gmail.com
Thu Nov 10 19:44:47 CET 2011


Hi:

Add a background = 'color' argument to key():

library('lattice')
xyplot(1~1,
      panel = function(x,y, ...) {
          panel.xyplot(x,y)
                  panel.abline(v=seq(0,1.4,by=0.1))
                  panel.abline(h=seq(0,1.4,by=0.1))
                }
      ,key = list (x=0.2, y=0.88,
                   points = list(col=c("red","green"),pch=20, cex=2),
                   text=list(c("aaaaaaaaa","zzzzzzzzz")),
                   background = 'white')    )

Dennis

On Thu, Nov 10, 2011 at 8:09 AM, PtitBleu <ptit_bleu at yahoo.fr> wrote:
> Hello,
>
> Sorry in advance for adding a silly question on this forum but I haven't
> found the right keywords to find a solution to this basic problem.
> I'm just looking a way to have a white background behind the legend to hide
> the grid.
>
> Thanks in advance.
>
>
> The silly example for my silly question:
>
> xyplot(1~1,
>       panel = function(x,y, ...) {
>           panel.xyplot(x,y)
>                   panel.abline(v=seq(0,1.4,by=0.1))
>                   panel.abline(h=seq(0,1.4,by=0.1))
>                 }
> ,key=list(x=0.2, y=0.88, points=list(col=c("red","green"),pch=20, cex=2),
> text=list(c("aaaaaaaaa","zzzzzzzzz")))
> )
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/newbie-s-question-xyplot-legend-with-a-white-background-tp4024152p4024152.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list