Recently, with @3wen, we wanted to play with isodensity curves. The problem is that it is difficult to get – numerically – the equation of the contour (even if we can easily plot it). Consider the following surface (just for fun, in order to illustrate the idea)
> f=function(x,y) x*y+(1-x)*(1-y) > u=v=seq(0,1,length=21) > v=seq(0,1,length=11) > f=outer(u,v,f) > persp(u,v,f,theta=angle,phi=10,box=TRUE, + shade=TRUE,ticktype="detailed",xlab="", + ylab="",zlab="",col="yellow")
For instance, assume that we want to locate areas where the density exceed 0.7 (here in the lower left corner, SW, and the upper right corner, NE)
> image(u,v,f) > contour(u,v,f,add=TRUE,levels=.7)