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.
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)
On Wed, Aug 25, 2010 at 11:04 AM, Kay Cichini
<Kay.Cichini@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@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]]
exactly - thanks a lot, richard! kay Zitat von "RICHARD M. HEIBERGER" <rmh at temple.edu>:> 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) > > > 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. >> >
... i added relation="free" to account for diffferent ranges of y1 and
y2:
dotplot(y1+y2 ~ facs$Treatment|facs$Sites,
outer=TRUE,
scales = list(y = list(relation="free"), x = list(rot = 90,
tck=c(1,0))),
ylab=c("y1", "y2"),
xlab=c("Site 1", "Site 2"),
strip=FALSE)
but then i get four different y-lims.
more suited there should be only two - one for each response.
can someone tell me how i have to change the code?
best,
kay
> 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)
>
>
> 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.
>>
>
______________________________________________
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.
-----
------------------------
Kay Cichini
Postgraduate student
Institute of Botany
Univ. of Innsbruck
------------------------
--
View this message in context:
http://r.789695.n4.nabble.com/lattice-help-required-tp2338382p2338641.html
Sent from the R help mailing list archive at Nabble.com.
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 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Hi Coming a bit late to the thread another way to reduce the space between the panels may be along the lines of Deepayan's reply with the layout.widths in http://finzi.psych.upenn.edu/R/Rhelp02/archive/43626.html I regularly use this and the latticeExtra addition will be welcome - I have not downloaded it yet. Also the 'useOuterStrips' from the latticeExtra package.may be of assistance in the setting the strips. Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email home: mackay at northnet.com.au At 17:34 26/08/2010, you wrote:>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 >%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% > >______________________________________________ >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.