[R-SIG-Mac] Question about line type in contour() function (R 2.11.1)

David B. Thompson, Ph.D., P.E., D.WRE, CFM drdbthompson at gmail.com
Fri Aug 6 01:18:41 CEST 2010


I'm running R 2.11.1 (MacBook Pro and OS X 10.6.4) and am trying to set a line type in the contour() function. What I did was:

> u<-seq(0.005,0.995,0.005)
> v<-u
> p<-rep(0,length(u)*length(u))
> dim(p)<-c(length(v),length(v))
> for (i in 1:length(u)) for (j in 1:length(v)) p[i,j]<-u[i]^2+v[j]^2
> contour(u,v,p)

This produces a nice contour plot, as expected. However, if I execute:

> contour(u,v,p,lty=2)

I still get a solid line drawn.

I also tried:

> contour(u,v,p,lty="dashed")

with the same result (solid line).

Interestingly, if I load the volcano data from the datasets package and run

> contour(volcano,lty=2)

R draws a nice dashed line for the contours.

I tried the usual suspects (Googled plenty) and have not found a solution to my issue. has anyone else encountered this problem? Any clues for me? I don't mind doing the work, but am at a lack for direction.

Thanks...

-=d

P.S. I can attach a graphic if that would help, but thought I'd preserve the bandwidth for this iteration.



More information about the R-SIG-Mac mailing list