Skip to content
Prev 26304 / 398502 Next

adding contour lines to a filled.contour

There is an easier solution.  Try,

junk.mat <- matrix(rnorm(1600), 16, 100)
contour.mat <- ifelse(junk.mat < 2, 0, junk.mat)
filled.contour(junk.mat, color = terrain.colors, 
               plot.axes = contour(contour.mat, levels = 1, 
                                   drawlabels = FALSE, axes = FALSE, 
                                   frame.plot = FFALSE, add = TRUE))

The 'plot.axes' argument to filled.contour() gives you access to the
coordinate system in the actual plotting area.  However, you will notice
that the axes are missing.  You need to add them explicitly, as in:

filled.contour(junk.mat, color = terrain.colors, 
               plot.axes = { contour(contour.mat, levels = 1, 
                                     drawlabels = FALSE, axes = FALSE, 
                                     frame.plot = FFALSE, add = TRUE);
			     axis(1); axis(2) } )

This also useful for adding titles, text annotations, points, etc. 

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng
On Sun, 15 Dec 2002, Uwe Ligges wrote: