[R] contour plot - line passing through z values

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jun 19 22:09:20 CEST 2008

On 6/19/2008 12:51 PM, Jehol wrote:
> Dear all,
> there is much in these forums about adding a line to a
> contour/filled.contour plot, but I haven't found hints for the following. I
> apologize in advance if I just missed the right one.
> I'm having a standard filled.contour plot to which I want to add a line
> passing through some specific z-values at some specific x, without knowing
> the y coordinates. There should be a way of getting these coordinates
> (within the accuracy defined by nlevels in the initial filled.contour) but
> I'm not sure how to do that, particularly as filled.contour does not return
> any values.
> If anyone's got any idea...please help.

The contourLines function will return x and y values corresponding to a 
contour.  You could search that result for a segment that crosses the x 
value of interest.

Duncan Murdoch

More information about the R-help mailing list