Re: [R] Plot contour over filled contour

From: S Ellison <>
Date: Fri, 14 Mar 2008 11:14:09 +0000

>>> "Devred, Emmanuel" <> 13/03/2008 18:08:45

Dear R-users,

>I haven't found a way in the searchable archive to overplot a contour
>(lines) over a surface.

I got round this by using the plot.axis parameter, which accepts a set of plotting commands and isn't fussy about what. Since this is implemented before the plot parameters are reset on return, it puts the contours in the right places without hacking about with par() etc.

My example (from a response surface fit to some analytical chemistry data) was

filled.contour(x=HCl, y=HNO3, z=td.g,

        plot.axes={axis(1);axis(2);contour(x=HCl, y=HNO3, z=td.g, add=T)},

	main="Typical Diet", xlab="HCl (ml)", ylab="HNO3 (ml)")

In this example, HCl and HNO3 were the two independent variables and td.g was the matrix of responses.
Note the call to contour(... add=T) inside plot.axes={}. rgb.palette was just an alternative rainbow-like palette I'd defined using .

This email and any attachments are confidential. Any use...{{dropped:8}} mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 14 Mar 2008 - 11:38:01 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 Fri 14 Mar 2008 - 12:30:22 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive