maechler@stat.math.ethz.ch
2004-Jul-13 18:22 UTC
[Rd] text(x, y, labels) - recycling problems and RFC (PR#7084)
Not a bug necessarily, in text(), but at least an inconsistency, and a need for more documentation: Contrary to e.g., plot(), text(x,y,labels) *does* recycle it's arguments to some extent -- and probably has always in S. However it doesn't do all I think it should, i.e., plot(1:7); text(1:2, 1+ 1:3, LETTERS[1:4]) does recycle 'x' to c(1:2, 1) {length 3} to match 'y' but doesn't recycle to length 4 in order to match 'labels'. While one can well accept this, I believe it should give a warning since it silently 'drops' the "d". However, I'm proposing to consider S(-plus) compatibility here. In S-PLUS 6.1, the result of the above is identical to plot(1:7); text(rep(1:2,length=4), rep(1+ 1:3, length=4), LETTERS[1:4]) i.e. (x,y) is recycled to length 4, the length of 'labels'. Further note that in plot(1:7); text(1:2, 1+ 1:3, LETTERS[1:2], col=2:6) the 'labels' *are* recycled to length 3, matching (x,y) -- but not to length 5 of 'col' which is fine -- just not the other way around. I'd propose that R should recycle all three (x,y,labels) [but not more] to common length. BTW, "grid" graphics do recycle as well, at least grid.text(labels, x, y) does --- and as I see it does also recycle at least the 'rotation'. Martin Maechler
Apparently Analagous Threads
- text(x, y, labels) - recycling problems and RFC (PR#7084)
- Cartridge Recycling OccYYUdqVk
- Recycling directories and backup performance. Was: Re: rsync --link-dest won't link even if existing file is out of date (fwd)
- text( col=, cex=, font=) : doesn't allow more than length-1 arg (PR#287)
- lattice legend colors recycling sooner than expected