newbie's question : xyplot legend with a white background

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

newbie's question : xyplot legend with a white background

PtitBleu
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")))
)
Reply | Threaded
Open this post in threaded view
|

Re: newbie's question : xyplot legend with a white background

djmuseR
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 <[hidden email]> 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.
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.