[R] lattice help required

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Aug 26 09:34:38 CEST 2010


On Wed, 2010-08-25 at 11:30 -0400, RICHARD M. HEIBERGER wrote:
> Kay,
> 
> doe this do what you want?
> 
> 
> dotplot(y1+y2 ~ facs$Treatment|facs$Sites,
>         outer=TRUE,
>         scales = list(x = list(rot = 90, tck=c(1,0))),
>         ylab=c("y1", "y2"),
>         xlab=c("Site 1", "Site 2"),
>         strip=FALSE)

This would be better, to avoid abusing the poor R formula handling
sugar:

dotplot(y1 + y2 ~ Treatment | Sites, ## no $
        ## Supply a data argument
        data = facs,
        ## as before
        outer=TRUE,
        scales = list(x = list(rot = 90, tck=c(1,0))),
        ylab=c("y1", "y2"),
        xlab=c("Site 1", "Site 2"),
        strip=FALSE)

G

> 
> On Wed, Aug 25, 2010 at 11:04 AM, Kay Cichini <Kay.Cichini at uibk.ac.at>wrote:
> 
> >
> > hello,
> >
> > i want to stack two lattice plots beneath each other using one x-axis and
> > sharing the same text-panels,
> > like:
> > #####################################################################
> > library(lattice)
> >
> > y1 <- rnorm(100,100,10)
> > y2 <- rnorm(100,10,1)
> > facs<-expand.grid(Sites=rep(c("Site I","Site II"),25),Treatment=c("A","B"))
> > pl1<-dotplot(y1 ~ facs$Treatment|facs$Sites,
> >             scales = list(x = list(rot = 90, tck=c(1,0))))
> > pl2<-dotplot(y2 ~ facs$Treatment|facs$Sites,
> >             scales = list(x = list(rot = 90, tck=c(1,0))))
> >
> > print(pl1, split=c(1,2,1,2), more=TRUE)
> > print(pl2, split=c(1,1,1,2))
> > #####################################################################
> >
> > but as said, ideally the plots should be stacked with only the lower plot
> > giving the x-axis annotation
> > and only the upper plot with text-panels.
> >
> > thanks a lot,
> > kay
> >
> > -----
> > ------------------------
> > Kay Cichini
> > Postgraduate student
> > Institute of Botany
> > Univ. of Innsbruck
> > ------------------------
> >
> > --
> > View this message in context:
> > http://r.789695.n4.nabble.com/lattice-help-required-tp2338382p2338382.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<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list