Two questions about the cloud function in the lattice package

3 messages Options
Embed this post
Permalink
Martin Eklund

Two questions about the cloud function in the lattice package

Reply Threaded More More options
Print post
Permalink
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)?

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

Some sample code:

data(iris)
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"))))

Neither setting border=F nor changing font=c(1,1,1) to font=c(3,3,3)  
seem to do anything (as far as I can tell), which was how I thought  
that I could remove the framing border and italicize the text in the  
figure legend.

Does anyone have any pointers as to how to achieve what I would like  
to do?

Thank you very much!

Martin.

 > sessionInfo()
R version 2.9.0 (2009-04-17)
i386-apple-darwin8.11.1

locale:
sv_SE.ISO8859-1/sv_SE.ISO8859-1/C/C/sv_SE.ISO8859-1/sv_SE.ISO8859-1

attached base packages:
[1] grid      splines   stats     graphics  grDevices utils     datasets
[8] methods   base

other attached packages:
  [1] rgl_0.84           lme4_0.999375-28   Matrix_0.999375-27  
ROCR_1.0-2
  [5] gplots_2.7.1       caTools_1.9        bitops_1.0-4.1      
gdata_2.4.2
  [9] gtools_2.6.1       rjags_1.0.3-8      coda_0.13-4        
lattice_0.17-25
[13] penalized_0.9-23   survival_2.35-4

loaded via a namespace (and not attached):
[1] tcltk_2.9.0 tools_2.9.0

========================================
Martin Eklund
PhD Student
Department of Pharmaceutical Biosciences
Uppsala University, Sweden
Ph: +46-18-4714281
========================================





        [[alternative HTML version deleted]]

______________________________________________
[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.
David Winsemius

Re: Two questions about the cloud function in the lattice package

Reply Threaded More More options
Print post
Permalink

On Jul 3, 2009, at 1:02 PM, Martin Eklund wrote:

> data(iris)
> 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),

#try adding
par.box=list(col="white"),

> 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"))))

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
[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.
Deepayan Sarkar

Re: Two questions about the cloud function in the lattice package

Reply Threaded More More options
Print post
Permalink
In reply to this post by Martin Eklund
On Fri, Jul 3, 2009 at 10:02 AM, Martin
Eklund<[hidden email]> 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

______________________________________________
[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.