[R] Vector lty argrument for lines or plot

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Fri Nov 21 20:06:46 CET 2008


Brian Diggs wrote:
>Thank you for the suggestion, baptiste. segments() does do exactly what
I was wanting and matplot()/matlines() is probably a better solution to
what I was trying to do.
> 
> However, I am still concerned about the discrepancy between the
documentation in ?par and the behavior of lines(). Should lines() be
changed to cycle over a vector of lty (so that it agrees with the
documentation in ?par)? Should the documentation of par be changed to
use a different example of a function that cycles over a vector of lty
(segments() being a good candidate)? Or are both lines() and ?par
correct and there is a situation which lines() does cycle over a vector
of lty that I (and at least baptiste as well) do not understand? The
middle option is certainly the easiest, and I think the correct one, but
I wanted to rule out the last one before filing a bug report.
> 

The documentation for lines has

     'lwd' can be a vector: its first element will apply to lines but
     the whole vector to symbols (recycled as necessary).

which really is true, and you might expect something similar for lty,
but lty does not apply to symbols.  So the text in ?par is most likely a
copy-paste blunder. In any case, this usage is somewhat far-fetched and
a reference matplot() or segments() would, in both cases, express more
clearly what ?par is trying to say.



-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list