Thursday, April 10, 2014

R Contour / Density Scatter plot

http://stats.stackexchange.com/questions/31726/scatterplot-with-contour-heat-overlay

n = 10000;
a = as.matrix( rnorm(n) );
dim(a) =  c( n/2, 2 );
z = kde2d( a[,1], a[,2], n=50 );
plot( a[,1], a[,2], cex=0.5 );
contour( add=T, z, col=1:11 );

No comments: