From murdoch.duncan at gmail.com  Fri Aug  6 14:28:47 2010
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Fri, 06 Aug 2010 08:28:47 -0400
Subject: [Rd] [R-SIG-Mac] Question about line type in contour() function
 (R 2.11.1)
In-Reply-To: <4C5BF771.7040009@gmail.com>
References: <06B4A3B2-0496-46D5-B34F-3E472A94EEC5@gmail.com>	<4C5B5540.3040406@gmail.com>
	<B7BDA7CF-1A40-4E03-A504-A29E4B543A5A@gmail.com>
	<4C5BF771.7040009@gmail.com>
Message-ID: <4C5BFFFF.6040804@gmail.com>

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



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