[R] xyplot lattice fine control of axes limits and thick marks (with log scale)

ilai keren at math.montana.edu
Wed Mar 28 17:07:40 CEST 2012


On Wed, Mar 28, 2012 at 4:21 AM, maxbre <mbressan at arpa.veneto.it> wrote:
> After a long and winding road (sorry but I'm a novice) I get to a final
> result which is quite close to what I need;
> nevertheless I would like to tweak a little further the xyplot

Without dput(mydata) you are the only one who can do that...

so that I can
> get ***for each single panel defined by variable z*** a finer control over:
> -the x and y the limits: I would like to be the same for both axes;

relation='same' in the scales. BTW this is the default, why did you
change to 'free' ?

> -the number of thick marks: again I would like to be same for both axes;

Most modifications of tick marks, labels and limits are easy through
the scales argument. ?xyplot and examples.

Best,
Elai

>
> the (general) code snippet here attached does not get this result;
> any help for this ?
>
> thank you
>
>
> #my example
>
> xyplot(y ~ x | z, data=mydata,
>       aspect="xy",
>       scales= list(x=list(relation="free", log=10),
>                    y=list(relation="free", log=10)),
>
>       prepanel = function(x, y, subscripts) {
>         list(xlim = c(min(x,y), max(x,y)))
>         list(ylim= c(min(x,y), max(x,y)))
>       },
>
>       panel = function(x, y ,subscripts,...) {
>         #panel.xyplot(x, y, xlim = c(min(x,y), max(x,y)), ylim =
> c(min(x,y), max(x,y)),...)
>         panel.xyplot(x, y, ...)
>         panel.abline(a = 0, b = 1, lty = 2, col ="gray")
>         panel.text(x, y, labels=mydata$name[subscripts])
>       },
>
>       subscripts=TRUE,
>       xscale.components = xscale.components.logpower,
>       yscale.components = yscale.components.logpower
>     )
>
> in attachment  http://r.789695.n4.nabble.com/file/n4511897/my_example.png
> my_example.png
>
> --
> View this message in context: http://r.789695.n4.nabble.com/xyplot-lattice-fine-control-of-axes-limits-and-thick-marks-with-log-scale-tp4511897p4511897.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.



More information about the R-help mailing list