[R] scatter plot to contour plot

Duncan Murdoch murdoch.duncan at gmail.com
Mon Feb 24 19:44:54 CET 2014


On 24/02/2014 12:45 PM, azam jaafari wrote:
> Dear All
>
> I want to convert a scatter plot to a continuous contour plot. I have "x" as a variable and "y" as another variable.
> is there any package for this?
> can anybody halp me?

A contour plot of values associated with the points, or a contour plot 
of the density of the points?  For the former, I think you want to use 
the akima package; for the density estimate, you could use kde2d from 
the MASS package.

In either case, you need to compute the values of the function on a 
grid, then the contour() function can plot it.

Duncan Murdoch




More information about the R-help mailing list