Skip to content
Prev 106289 / 398506 Next

Draw a circle on a filled.contour() plot

Hi
On 17 Dec 2006 at 10:04, Duncan Murdoch wrote:
Date sent:      	Sun, 17 Dec 2006 10:04:37 -0500
From:           	Duncan Murdoch <murdoch at stats.uwo.ca>
To:             	Webmaster <webmaster at citedesjeunes.com>
Copies to:      	r-help at stat.math.ethz.ch
Subject:        	Re: [R] Draw a circle on a filled.contour() plot
You possibly can use

image(...)
contour(..., add=T)

to get contours overlayed e.g.

x <- y <- seq(-4*pi, 4*pi, len=27)
r <- sqrt(outer(x^2, y^2, "+"))
image(z = z <- cos(r^2)*exp(-r/6), col=gray((0:32)/32))
image(z, axes = FALSE, main = "Math can be beautiful ...",
      xlab = expression(cos(r^2) * e^{-r/6}))
contour(z, add = TRUE, drawlabels = FALSE)

HTH
Petr
Petr Pikal
petr.pikal at precheza.cz