[R] xyplot lattice fine control of axes limits and thick marks (with log scale)
ilai
keren at math.montana.edu
Thu Mar 29 16:57:35 CEST 2012
On Thu, Mar 29, 2012 at 3:04 AM, maxbre <mbressan at arpa.veneto.it> wrote:
<snip>
> To answer your question:
> - I did not put relation=’same’ because that is not what I want: i.e **for
> each single panel** (in my case 4) I want to set the same limits for both x
> and y axes (I want the diagonal line exactly bisect each panel); see what
> happen by putting relation=’same’…(I do not want to group the panels by a
> single x and y axes)
> - I need to set the same number of thick arks for both x and y axes *of each
> panel*, but with log scale it’s quite tricky at least seems so to myself)
Oh. I missed the *for each panel* aspect of your question. I believe
you are 5 key strokes away (the change is to prepanel). Is this what
you want ?
xyplot(tv ~ ms | sub_family, data=tm,
#as.table=TRUE,
aspect="xy",
xlab = expression(paste('ms [ fg/', m^3, ' ]', sep = '')),
ylab = expression(paste('tv [ fg/', m^3, ' ]', sep = '')),
scales= list(x=list(relation="free", log=10, cex=0.8),
y=list(relation="free", log=10, cex=0.8)),
prepanel = function(x, y, subscripts) {
rr<- range(cbind(x,y))
list(xlim = rr, ylim= rr)
},
panel = function(x, y ,subscripts,...) {
panel.xyplot(x, y, cex=0.8,...)
panel.abline(a = 0, b = 1, lty = 2, col ="gray")
panel.text(x, y, labels=tm$name_short[subscripts], cex = 0.8,
pos=3, offset=0.5, srt=0, adj=c(1,1))
}, subscripts=TRUE,
xscale.components = xscale.components.logpower,
yscale.components = yscale.components.logpower
)
Cheers
>
> Thanks for your help
>
> max
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/xyplot-lattice-fine-control-of-axes-limits-and-thick-marks-with-log-scale-tp4511897p4514868.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