Bernd Weiss
2007-Sep-05 04:47 UTC
[R] [Lattice] Incrase the height of strips in Trellis plots
Dear all,
I wonder how to increase the height of strips via strip.default or
strip.custom. The following example hopefully illustrates the difficulty
I am facing:
library(lattice)
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = strip.custom(par.strip.text = list(cex = 2)))
Thanks for any advice,
Bernd
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 5.1
year 2007
month 06
day 27
svn rev 42083
language R
version.string R version 2.5.1 (2007-06-27)
Frede Aakmann Tøgersen
2007-Sep-05 07:19 UTC
[R] [Lattice] Incrase the height of strips in Trellis plots
This should give you something close to what you want:
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = strip.custom(par.strip.text = list(cex = 2)),
par.settings = list(layout.heights=list(strip=1.45)))
The par.settings argument alters locally the default par settings of lattice
plots, see e.g. ?trellis.par.get and the ?xyplot about the par.settings
argument.
A closer inspection (try using strip = 2 or numbers less than 1.45 in stead of
strip = 1.45) of the figure reveals that there are some problems with vertical
alignment of the strip text, i.e. not centered.
To remedy this I think that you have to use you own strip function. You may be
able to build you own function by altering the default strip function, see
?lattice.options and try lattice.options() at the command prompt. However this
may be more difficult than it seems at first. Perhaps some one more familiar
with the lattice package can solve this.
Best regards
Frede Aakmann T?gersen
Scientist
UNIVERSITY OF AARHUS
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology
Blichers All? 20, P.O. BOX 50
DK-8830 Tjele
Phone: +45 8999 1900
Direct: +45 8999 1878
E-mail: FredeA.Togersen at agrsci.dk
Web: http://www.agrsci.org
This email may contain information that is confidential.
Any use or publication of this email without written permission from Faculty of
Agricultural Sciences is not allowed.
If you are not the intended recipient, please notify Faculty of Agricultural
Sciences immediately and delete this email.
> -----Oprindelig meddelelse-----
> Fra: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] P? vegne af Bernd Weiss
> Sendt: 5. september 2007 06:48
> Til: r-help at stat.math.ethz.ch
> Emne: [R] [Lattice] Incrase the height of strips in Trellis plots
>
> Dear all,
>
> I wonder how to increase the height of strips via
> strip.default or strip.custom. The following example
> hopefully illustrates the difficulty I am facing:
>
> library(lattice)
> xyplot(Petal.Length ~ Petal.Width | Species, iris,
> strip = strip.custom(par.strip.text = list(cex = 2)))
>
> Thanks for any advice,
>
> Bernd
>
>
> > version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 5.1
> year 2007
> month 06
> day 27
> svn rev 42083
> language R
> version.string R version 2.5.1 (2007-06-27)
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
Bernd Weiss
2007-Sep-05 07:44 UTC
[R] [Lattice] Incrase the height of strips in Trellis plots
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Frede Aakmann T?gersen schrieb:> This should give you something close to what you want: > > > xyplot(Petal.Length ~ Petal.Width | Species, iris, > strip = strip.custom(par.strip.text = list(cex = 2)), > par.settings = list(layout.heights=list(strip=1.45))) > > The par.settings argument alters locally the default par settings of lattice plots, see e.g. ?trellis.par.get and the ?xyplot about the par.settings argument. > > A closer inspection (try using strip = 2 or numbers less than 1.45 in stead of strip = 1.45) of the figure reveals that there are some problems with vertical alignment of the strip text, i.e. not centered. > > To remedy this I think that you have to use you own strip function. You may be able to build you own function by altering the default strip function, see ?lattice.options and try lattice.options() at the command prompt. However this may be more difficult than it seems at first. Perhaps some one more familiar with the lattice package can solve this.Perfect! Thank you very much, Bernd -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG3l5cUsbvfbd00+ERAh1qAJ4tw3ZiIYnI+UF6FJeLT1xRMep/VACfR+I1 R14RJkdaFBNFqVc6kibyaRk=W41I -----END PGP SIGNATURE-----
deepayan.sarkar at gmail.com
2007-Sep-05 07:56 UTC
[R] [Lattice] Incrase the height of strips in Trellis plots
On 9/5/07, Frede Aakmann T?gersen <FredeA.Togersen at agrsci.dk> wrote:> This should give you something close to what you want: > > > xyplot(Petal.Length ~ Petal.Width | Species, iris, > strip = strip.custom(par.strip.text = list(cex = 2)), > par.settings = list(layout.heights=list(strip=1.45))) > > The par.settings argument alters locally the default par settings of lattice > plots, see e.g. ?trellis.par.get and the ?xyplot about the par.settings > argument.Another possibility that predates par.settings (but is basically equivalent) is xyplot(Petal.Length ~ Petal.Width | Species, iris, par.strip.text = list(lines = 2, cex = 2)) -Deepayan