[R] labeling contours that are output from contourLines

Jeanne Thibeault jeanniet at geo.umass.edu
Tue Nov 15 21:23:40 CET 2005


Hello,

I have been trying to map some climate data using contourLines on a
projected map. The following code seems to work well to add the lines, but
the lines are not labeled:

res <- contourLines(data.li)
contours_x <- unlist(sapply(res, function(x) c(x$x, NA))) 
contours_y <- unlist(sapply(res, function(x) c(x$y, NA))) 
contours <- list(x= contours_x, y = contours_y)
lines(mapproject(contours, proj = ""), type="l")

I was thinking about trying to adapt some of the code from
panel.levelplot(), but was wondering if someone else had already written a
labeling function.

Thanks for the help,
Jeanne




More information about the R-help mailing list