Tim Hesterberg
2009-Oct-02 15:22 UTC
[Rd] suggest enhancement to segments and arrows to facilitate horizontal and vertical segments
I suggest a simple enhancement to segments() and arrows() to facilitate drawing horizontal and vertical segments -- set default values for the second x and y arguments equal to the first set. This is handy, especially when the expressions for coordinates are long. Compare: Segments: < function (x0, y0, x1 = x0, y1 = y0, col = par("fg"), lty = par("lty"), ---> function (x0, y0, x1, y1, col = par("fg"), lty = par("lty"),Arrows: < function (x0, y0, x1 = x0, y1 = y0, length = 0.25, angle = 30, code = 2, ---> function (x0, y0, x1, y1, length = 0.25, angle = 30, code = 2,Tim Hesterberg
Prof Brian Ripley
2009-Oct-05 12:44 UTC
[Rd] suggest enhancement to segments and arrows to facilitate horizontal and vertical segments
This isn't a one-way street, as it means that some erroneous calls will not be detected, and code written to take advantage of this will only work under R >= 2.10.0. I think we should probably insist that one of x1 and y1 is supplied: if both are omitted arrows() would give a warning, but segments() would not. On Fri, 2 Oct 2009, Tim Hesterberg wrote:> I suggest a simple enhancement to segments() and arrows() to > facilitate drawing horizontal and vertical segments -- > set default values for the second x and y arguments equal to the first set. > This is handy, especially when the expressions for coordinates are long. > > Compare: > > Segments: > < function (x0, y0, x1 = x0, y1 = y0, col = par("fg"), lty = par("lty"), > --- >> function (x0, y0, x1, y1, col = par("fg"), lty = par("lty"), > > Arrows: > < function (x0, y0, x1 = x0, y1 = y0, length = 0.25, angle = 30, code = 2, > --- >> function (x0, y0, x1, y1, length = 0.25, angle = 30, code = 2, > > Tim Hesterberg-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Apparently Analagous Threads
- documenation for arrows() is backwards (PR#7839)
- arrows: no vectors for "code" and "angle" parameters
- segments() with zero-length arguments (PR#11192)
- Request - adding recycled "lwd" parameter to polygon
- Request - adding recycled "lwd" parameter to polygon