[R] adding contour lines to a filled.contour
Andy Bunn
abunn at montana.edu
Sat Dec 14 23:42:02 CET 2002
Hi all,
Does anybody know how to add contour lines to a filled contour plot?
I want to draw a single contour around values that are above a certain
level (e.g., significant). The problem I'm having is that since the
filled.contour command actually draws two plots (data and the key),
adding contour lines paints them over both plots.
Any suggestions?
Thanks, Andy
#~~~~~~~~~~~~~~~~~~~
#example
junk.mat <- matrix(rnorm(1600), 16, 100)
filled.contour(junk.mat,
color = terrain.colors)
#set values < 2 to zero
contour.mat <- ifelse(junk.mat < 2, 0, junk.mat)
#add contours
contour(contour.mat,
levels = 1,
drawlabels = F,
axes = F,
frame.plot = F,
add = T)
More information about the R-help
mailing list