Full_Name: Brian D. Peyser Version: 2.1 (also 2.3) OS: Windows XP Pro Submission from: (NULL) (162.129.236.18) In the documentation for par() (both on-line and manual) there is an error regarding line type specification (lty). It actually omits a feature. The documentation states that a string up to 8 NON-ZERO hexadecimal digits may be used to specify on/off lengths, i.e. "44" = "dashed". However, lty DOES accept zero: plot(NA, NA, xlim=c(-2,2), ylim=c(-2,2)) abline(h=1, lwd=2, col="black", lty="0880") abline(h=1, lwd=2, col="gray", lty="88") This will produce a plot with a horizontal line that is alternately gray and black. The first number is length "on", then length "off", so that the black line starts with zero length on, then 8 off, then 8 on, then zero off, such that the zeroes effectively swap the "on" and "off" positions. The gray line starts "on" for 8 units then "off" for 8. -Brian Peyser
ripley at stats.ox.ac.uk
2006-May-30 21:38 UTC
[Rd] Documentation error for par(lty) (PR#8914)
Whether this works or not depends on the graphics device. The description in the driver sources says * Line textures are stored as an array of 4-bit integers within * a single 32-bit word. These integers contain the lengths of * lines to be drawn with the pen alternately down and then up. * An integer containing a zero terminates the pattern. Your example does not work on the pdf() device, for example. So the documentation accurately describes what is guaranteed to work. (On Windows the GDI is used and that accepts more possibilities, it seems. We may well alter that.) On Tue, 30 May 2006, bpeyser at jhmi.edu wrote:> Full_Name: Brian D. Peyser > Version: 2.1 (also 2.3)There are no such versions: please do note what the posting guide says about this (and reporting on current versions, now 2.3.1 RC)> OS: Windows XP Pro > Submission from: (NULL) (162.129.236.18) > > > In the documentation for par() (both on-line and manual) there is an error > regarding line type specification (lty). It actually omits a feature. The > documentation states that a string up to 8 NON-ZERO hexadecimal digits may be > used to specify on/off lengths, i.e. "44" = "dashed". > > However, lty DOES accept zero: > > plot(NA, NA, xlim=c(-2,2), ylim=c(-2,2)) > abline(h=1, lwd=2, col="black", lty="0880") > abline(h=1, lwd=2, col="gray", lty="88") > > This will produce a plot with a horizontal line that is alternately gray > and black. The first number is length "on", then length "off", so that > the black line starts with zero length on, then 8 off, then 8 on, then > zero off, such that the zeroes effectively swap the "on" and "off" > positions. The gray line starts "on" for 8 units then "off" for 8. > > -Brian Peyser-- 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