Skip to content
Prev 260188 / 398502 Next

Smooth contour of a map

I've pratically resolved my problem (the code is under that), but a last thing is not perfect:
when I use the function plot to call after the function polygon, there is a marge between my raster and the window. I think it's the axis of the function "plot()", but I have not found how delete it. Someone have a solution please?

Pierre Bruyer

##smooth contour
	
	contours <- contourLines(V2b,levels=paliers)

	
	par(mar=c(0,0,0,0))
	plot(1,col="white",main="polygon()", asp = 1, axes = FALSE, ann = FALSE,xlim=c(0,1), ylim = c(0,1),type = "n", method = c("image"))
	for (i in seq_along(contours)) {
 		 x <- contours[[i]]$x
 		 y <- contours[[i]]$y
 		 c <- contours[[i]]$level
 		 j <- 1
 		 tmp <- 0 
 		 while(j < length(level[,1]) && tmp == 0){
 		 	if(level[j,1] == c){
 		 		tmp <- j
 		 	}
 		 	j <- j+1 
 		}	

 		polygon( spline( seq_along(x), x)$y, spline( seq_along(y), y)$y ,col = colgraph[tmp+1], border = NA)
	}



Le 17 mai 2011 ? 16:44, Pierre Bruyer a ?crit :