[R] lattice panel fine control

Bert Gunter gunter.berton at gene.com
Fri Jun 3 05:47:30 CEST 2011


You're still not reading the Help carefully/thoroughly.

Check the entry under the "relation" subargument for the "scales"
argument of xyplot. You need relation = "same", which is the default
and so can be omitted.

-- Bert

On Thu, Jun 2, 2011 at 2:02 PM, maxbre <mbressan at arpa.veneto.it> wrote:
> ok thanks again for your reply: this is what I worked out so far
> #start code
> xyplot(ped.avg ~ tv.avg | family,
>               data=mydata,
>               strip=strip.custom(bg='white'), col.line=1, main="title",
>               xlab = expression(paste('tv [ fg/', m^3, ' ]', sep = '')),
>                           ylab = expression(paste('ped [ fg/', m^3, ' ]', sep = '')),
>
>               scales= list(x=list(relation="free", log=10),
>                            y=list(relation="free", log=10)
>                                                        ),
>                           as.table=TRUE,
>
>               prepanel = function(x, y, ...) {
>        xlim=list(c(1, 3), c(0.2,2.8), c(1.8,3.8),c(1.8,3))
>             ylim=list(c(1, 3), c(0.2,2.8), c(1.8,3.8),c(1.8,3))
>        dx=list(c(1.4,1.8,2.2,2.6), c(0.6,1,1.4,1.8,2.2,2.6), c(2.2,2.6,3,3.4,3.8),
> c(2.2,2.6,3))
>        dy=list(c(1.4,1.8,2.2,2.6), c(0.6,1,1.4,1.8,2.2,2.6), c(2.2,2.6,3,3.4,3.8),
> c(2.2,2.6,3))
>                                  },
>               panel = function(x, y,...) {
>                  panel.xyplot(x, y, cex=0.5,...)
>                  panel.abline(a = 0, b = 1, lty = 2, col ="gray")
>                  panel.text(x, y, lab = mydata$name, cex = 0.5, pos=3,
> offset=1, srt=90)
>                                                   },
>               xscale.components = xscale.components.logpower,
>               yscale.components = yscale.components.logpower
>    )
> #end code
>
> but still something is not clear at all to me;
> I've been reading the help files but I must confesss that are quite obscure
> to me; I would say there is a strange behaviour of this bit of code because
> I can not properly get a fine control of each panel x and y axis
>
>  prepanel = function(x, y, ...) {
>        xlim=list(c(1, 3), c(0.2,2.8), c(1.8,3.8),c(1.8,3))
>             ylim=list(c(1, 3), c(0.2,2.8), c(1.8,3.8),c(1.8,3))
>        dx=list(c(1.4,1.8,2.2,2.6), c(0.6,1,1.4,1.8,2.2,2.6), c(2.2,2.6,3,3.4,3.8),
> c(2.2,2.6,3))
>        dy=list(c(1.4,1.8,2.2,2.6), c(0.6,1,1.4,1.8,2.2,2.6), c(2.2,2.6,3,3.4,3.8),
> c(2.2,2.6,3))
>                                  },
>
> I would like to have for each panel x and y axis equallly sped and with
> equal limits; for some reasons I do not understand at all the aboe code did
> not get the wanted result
>
> any help for this?
>
> thank you, this is indeed a good learning session to me
>
> --
> View this message in context: http://r.789695.n4.nabble.com/lattice-panel-fine-control-tp3566347p3569380.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.
>



-- 
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics



More information about the R-help mailing list