# lattice: problem with cex argument. Classic List Threaded 5 messages Open this post in threaded view
|

## lattice: problem with cex argument.

 Hi, I'm trying to plot a "bubbles" plot wich I do with the cex argument. The problem is that it looks like it fails the conditioning and reuses the first 100 elements of the cex vector. See the code x <- rep(rep(1:10,10),2) y <- rep(rep(c(1:10),rep(10,10)),2) z <- rep(1:2,c(100,100)) w <- rpois(200,l=1) xyplot(y~x|z, cex=w) the plot has the same pattern in both sides but the data are different, see > tapply(w,z,summary) \$"1"    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    0.00    0.00    1.00    0.99    1.00    4.00 \$"2"    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    0.00    0.00    1.00    0.95    2.00    4.00 or the plots par(mfrow=c(1,2)) tapply(w,z,hist) and xyplot(w~x|y*z) Is this a feature or a bug ? Regards EJ ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|

## Re: lattice: problem with cex argument.

 On 3/31/06, ernesto <[hidden email]> wrote: > Hi, > > I'm trying to plot a "bubbles" plot wich I do with the cex argument. The > problem is that it looks like it fails the conditioning and reuses the > first 100 elements of the cex vector. See the code > > x <- rep(rep(1:10,10),2) > y <- rep(rep(c(1:10),rep(10,10)),2) > z <- rep(1:2,c(100,100)) > w <- rpois(200,l=1) > xyplot(y~x|z, cex=w) > > the plot has the same pattern in both sides but the data are different, see > > > tapply(w,z,summary) > \$"1" >    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. >    0.00    0.00    1.00    0.99    1.00    4.00 > > \$"2" >    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. >    0.00    0.00    1.00    0.95    2.00    4.00 > > or the plots > > par(mfrow=c(1,2)) > tapply(w,z,hist) > > and > > xyplot(w~x|y*z) > > Is this a feature or a bug ? Feature. The rule is simple: everything not relevant to the high level function is sent to the panel function unchanged (this is normally used to specify arguments of the panel function in the high level call). Nothing outside the formula is `conditioned'. The panel function will also be given, if requested, a 'subscripts' argument that provides indices of the rows in the original data used in that panel. Combining these you can condition anything you want inside the panel function, e.g. xyplot(y~x|z, cex = w,        panel = function(x, y, ..., cex, subscripts) {            panel.xyplot(x, y, ..., cex = cex[subscripts])        }) which is probably what you wanted. It took me a while to figure this out, but I think this feature of the Trellis design solves very elegantly a problem that would have been very hard to tackle directly. Deepayan ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|

## lattice, xyplot, lend=1, type="h"

 Is there is a way to make square bars in xyplot with type="h"? dat <- data.frame(foo = rep(1:10,2), bar = rep(1:10,2)) xyplot(foo~bar, data = dat, type="h",lwd=20) Thanks! Andy ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html