[R] Vector lty argrument for lines or plot

From: Brian Diggs <diggsb_at_ohsu.edu>
Date: Thu, 20 Nov 2008 12:24:52 -0800

I am confused by the behavior of the lines function when the lty argument is a vector. ?lines indicates that lty is a valid parameter, but says nothing else about it. ?plot.xy (which I think is what gets called) refers back to ?lines. ?plot.default says to see ?par. In ?par, about lty it says "Some functions such as lines accept a vector of values which are recycled. Other uses will take just the first value if a vector of length greater than one is supplied." However, I cannot get lines to use more than one type of line. Some example code:

pt <- runif(10)
lines(pt, type="c", lty=1:10)

I expected each subsequent line segment to be in a different style. Only the first seems to be used. The same is true for plot:

plot(pt, type="b", lty=1:10)

uses only one style of line segment (although no documentation says explicitly that the others would be used). It doesn't matter the order or manner of specification, only the first is used.

lines(pt, type="c", lty=c("dashed","solid"))

lines(pt, type="c", lty=c("FF", "11"))

I have used a vector of lty before (in legend) and it cycled through all the values. Am I misunderstanding what a vector lty to lines means, or is this a bug?

I'm running on Windows XP Pro, if that might matter.

> sessionInfo()

R version 2.8.0 (2008-10-20)

LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

Brian Diggs, Ph.D.
Senior Research Associate, Department of Surgery, Oregon Health & Science University

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 20 Nov 2008 - 20:28:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Nov 2008 - 21:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive