Re: [R] Smooth contour of a map

From: Pierre Bruyer <>
Date: Tue, 17 May 2011 14:24:34 +0200

Thank you for your answer, but the function spline() (and a lot of other function in R) can't take in its parameters the original contour which are define by a vector, i.e. :

	##creation of breaks for colors
	paliers <- c(-1.0E300)
		paliers <- c(paliers,level[i,1])
		i <- i+1
	paliers <- c(paliers, 1.0E300)

Le 17 mai 2011 13:05, Duncan Murdoch a crit :

> On 11-05-17 5:58 AM, Pierre Bruyer wrote:

>> I'm a French developer (so I am sorry if my english is not perfect). I have a problem to smooth the contours of a map. I have a dataset with 3 columns, x, y and z, where x and y are the coordinates of my points and z is evaluate to a qualitative elevation and his representation is a set of colors, which is define by levels.
>> The problem is the curve of my contour is so linear, and I would like a more continuous contour. I use the function fitted.contour to draw my map.

> If you use a finer grid of x,y values you'll get shorter segments and they will look smoother.
> You might be able to use a smooth interpolator (e.g. spline()) rather than linear interpolation, but those occasionally do strange things e.g.
> x <- c(1:4, 5.9, 6:10)
> y <- c(1:4, 7, 6:10)
> plot(spline(x,y, n=200), type="l")
> points(x,y)
> where one point is out of line with the others, but the curve overcompensates in order to stay smooth.
> Duncan Murdoch mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 17 May 2011 - 15:09:10 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 17 May 2011 - 15:15:07 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive