Dear R-users, I haven't found a way in the searchable archive to overplot a contour (lines) over a surface. I have a (n,m) matrix that represents sea surface temperature that I have plotted using image.plot(), filled.contour() or image(). I would like to overplot this image with some contour lines of mixed layer depth values(same size matrix). How can I do this? Any help is appreciated, thank you, Emmanuel ------------------------------------------- Dr. Emmanuel Devred Bedford Institute of Oceanography, 1 Challenger Drive, Dartmouth, Nova Scotia, B2Y 4A2, Canada Ph: (1) 902 426-4681 Fax: (1) 902 426-9388 devrede@mar.dfo-mpo.gc.ca http://myweb.dal.ca/edevred/ ------------------------------------------- [[alternative HTML version deleted]]
Devred, Emmanuel <DevredE <at> mar.dfo-mpo.gc.ca> writes:> I haven't found a way in the searchable archive to overplot a contour > (lines) over a surface. > I have a (n,m) matrix that represents sea surface temperature that I > have plotted using image.plot(), filled.contour() or image(). I would > like to overplot this image with some contour lines of mixed layer depth > values(same size matrix). How can I do this? >When I search for contour (nothing else), the first item by Uwe Ligges is probably what you want: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/2211.html Dieter
>>> "Devred, Emmanuel" <DevredE at mar.dfo-mpo.gc.ca> 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)}, color=rgb.palette, 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}}