On 06/08/2010 7:52 AM, Duncan Murdoch wrote:
On 05/08/2010 8:46 PM, David B. Thompson, Ph.D., P.E., D.WRE, CFM wrote:
On Aug 5, 2010, at 5:20 PM, Duncan Murdoch wrote:
On 05/08/2010 7:18 PM, David B. Thompson, Ph.D., P.E., D.WRE, CFM wrote:
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.
<snip>
A partial workaround:
x <- contourLines(u, v, p)
plot(range(u), range(v), type="n")
lapply(x, function(c) lines(c, lty=2)
Thanks for the quick response. I wondered about the grid size, but what I used
is about what it takes to get a nice-looking curve. I could play with the grid
size a bit to see if I can get a decent curve and a dashed line.
I wondered if it might be grid size. That was the only thing I could think of
that was different between the two datasets. I should have followed my instinct
and test it. Good call.
I can use the workaround, I think. I'll give that a go in the morning and
hopefully get over my hump and deliver the analyses.
I've moved this from r-sig-mac to r-devel; it's not a Mac problem. I've
also added back a bit of the context for readers here.
A little bit more on this: the problem only affects contour() when
labels are being drawn, and only if method is set to "flattest" (the
default) or "edge". If you set drawLabels=FALSE or method="simple" you
won't see it. I think I should be able to fix this after all.
Fixed now in R-patched and R-devel.
Duncan Murdoch
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel