maxbre
2012-Mar-28 10:21 UTC
[R] xyplot lattice fine control of axes limits and thick marks (with log scale)
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 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; -the number of thick marks: again I would like to be same for both axes; 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.
ilai
2012-Mar-28 15:07 UTC
[R] xyplot lattice fine control of axes limits and thick marks (with log scale)
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 xyplotWithout 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.
Maybe Matching Threads
- lattice xyplot point labelling
- lattice panel fine control
- Prettier axis labels when using log (or exp!!) scales in Lattice (follow up)
- Prettier axis labels when using log scales in Lattice
- Using Lattice, LatticeExtra - Hide right and top axes in multipanel plots