[R] combination of scatterplot and image graph

Romain François francoisromain at free.fr
Thu Dec 23 09:59:30 CET 2004


Hello,

you can fit a density using MASS::kde2d and then do a contour plot 
(?contour) and scatterplot your data :

x <- rnorm(500)
y <- rnorm(500)
require(MASS)
d <- kde2d(x,y,n=50)
image(d)
contour(d,add=T)
points(x,y,pch=20)

Romain.

bogdan romocea a écrit :

>Dear R users,
>
>I'm interested in a combination of a scatterplot and an image graph.
>I have two large vectors. Because in the scatterplot some areas are
>sparsely and others densely populated, I want to see the points, and
>I also want their color to be changed based on their density (similar
>to a heat map). Is there a function that can do that?
>
>Thank you,
>b.
>  
>
-- 
Romain FRANCOIS : francoisromain at free.fr
page web : http://addictedtor.free.fr/  (en construction)
06 18 39 14 69 / 01 46 80 65 60
_______________________________________________________
Etudiant en 3eme année
Institut de Statistique de l'Université de Paris (ISUP)
Filière Industrie et Services
http://www.isup.cicrp.jussieu.fr/




More information about the R-help mailing list