[R] Lattice: problem with setting space between plot and legend

Duncan Mackay mackay at northnet.com.au
Thu Aug 18 04:31:19 CEST 2011


Hi

If space="bottom" then I think that par.settings needs to be utilized

?xyplot
search for par.settings
names(trellis.par.get())
trellis.par.get()[[28]]
layout heights may be needed

  names(trellis.par.get()[[28]])
  [1] 
"top.padding"       "main"              "main.key.padding"  "key.top" 
           "xlab.top"          "key.axis.padding"
  [7] 
"axis.top"          "strip"             "panel" 
"axis.panel"        "between"           "axis.bottom"
[13] "axis.xlab.padding" 
"xlab"              "xlab.key.padding"  "key.bottom" 
"key.sub.padding"   "sub"
[19] "bottom.padding"

therefore one scenario is to add the argument to barchart eg to increase space

par.settings = list(layout.heights = list(key.top = 2)),

also bottom.padding etc depending on the requirements other arguments 
to layout heights may be necessary.

The request was not specific enough to elaborate.

HTH

Duncan


Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: home mackay at northnet.com.au



At 23:56 17/08/2011, you wrote:
>Hi,
>
>Maybe this post can help you:
>http://tolstoy.newcastle.edu.au/R/e2/help/06/10/2735.html
>
>On Wed, Aug 17, 2011 at 10:15 AM, mike1989 <mihau.kot at gmail.com> wrote:
>
> > Dear R Users,
> >
> > I am writing code to present my output data (I'm using Lattice Package).
> > However, it's essential for me to control space between barchart and
> > legend.
> > I've read the package's specification, but unfortunately I haven't spot the
> > information how to do this. Here's the code I've written:
> >
> > barchart(mymatrix[,1:ncol(mymatrix)],horizontal=FALSE,
> > box.width=1,stack=TRUE,border=FALSE,par.settings = simpleTheme(col
> >
> > 
> =my_colors),lty="dotted",lend="butt",key=list(space="bottom",columns=ncol(mymatrix),points=FALSE,text=list(colnames(mymatrix)),rectangles=list(border=FALSE,size=2,col=my_colors[1:ncol(mymatrix)]),border=FALSE,rows=1,between=0.25))
> >
> >
> > Thank you for any assistance.
> >
> > --
> > View this message in context:
> > 
> http://r.789695.n4.nabble.com/Lattice-problem-with-setting-space-between-plot-and-legend-tp3749919p3749919.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
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
>--
>Atenciosamente,
>
>Raphael Saldanha
>saldanha.plangeo at gmail.com
>
>         [[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.



More information about the R-help mailing list