[R] Two questions about the cloud function in the lattice package

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Jul 3 19:33:36 CEST 2009


On Fri, Jul 3, 2009 at 10:02 AM, Martin
Eklund<martin.eklund at farmbio.uu.se> wrote:
> Hi,
>
> I have two questions regarding the cloud function in the lattice
> package:
>
> 1) Is there a way to not print the surrounding frame (i.e. the square
> surrounding the entire plot)?

There is an example in the cloud help page that shows you how.

> 2) Is there a way to italicize the text displayed with the key argument?

Once you properly indent your code, it becomes clear that you 'font='
specification is an element of 'key$points', and so does not affect
how 'key$text' is shown:

cloud(Sepal.Length~Petal.Length*Petal.Width,data=iris,
      groups=Species,screen=list(z=20,x=-70), col=c("red","blue","green"),
      pch=c(20,20,20),
      perspective=FALSE,
      key=list(title="IrisData",x=.05,y=.95,corner=c(0,1),
               border=TRUE,
               points=list(alpha=c(1,1,1), cex=c(0.8,0.8,0.8),
                           col=c("red","blue","green"),
                           fill=c("#CCFFFF","#FFCCFF","#CCFFCC"),
                           font=c(1,1,1), pch=c(20,20,20)),
               text=list(c("setosa","versicolor","virginica"))))

You can either move the font specification to 'key$text', or move it
one level up directly as key$font:

cloud(Sepal.Length~Petal.Length*Petal.Width,data=iris,
      groups=Species,screen=list(z=20,x=-70), col=c("red","blue","green"),
      pch=c(20,20,20),
      perspective=FALSE,
      key=list(title="IrisData",x=.05,y=.95,corner=c(0,1),
               border=TRUE,
               font=c(3, 3, 3),
               points=list(alpha=c(1,1,1), cex=c(0.8,0.8,0.8),
                           col=c("red","blue","green"),
                           fill=c("#CCFFFF","#FFCCFF","#CCFFCC"),
                           pch=c(20,20,20)),
               text=list(c("setosa","versicolor","virginica"))))

-Deepayan




More information about the R-help mailing list