[R] Filled vector contours

Jan Tosovsky j.tosovsky at email.cz
Sun Aug 24 09:51:03 CEST 2014


Dear All,

I am trying to create vector output (SVG) of filled contours. 

I've found two approaches so far:

(1)
library('lattice')
svg("D:/test.svg")
filled.contour(volcano)
#levelplot(volcano, panel=panel.levelplot.raster) # panel.levelplot.raster
will make it raster
dev.off()

(2)
library("raster")
svg("D:/test.svg")
rr <- raster(t(volcano))
rc <- cut(rr, breaks= 10)
pols <- rasterToPolygons(rc, dissolve=T)
spplot(pols)
dev.off()

But I'd like to get smooth closed polygons not broken into small cells.

Are there better methods in R ?

Thanks, Jan



More information about the R-help mailing list