Scatterplots in ggplot2
Scatter plots with the 2d density estimation
The functions geom_density_2d() or stat_density_2d() can be used :
# Scatter plot with the 2d density estimation sp <- ggplot(faithful, aes(x=eruptions, y=waiting)) + geom_point() sp + geom_density_2d() # Gradient color sp + stat_density_2d(aes(fill = ..level..), geom="polygon") # Change the gradient color sp + stat_density_2d(aes(fill = ..level..), geom="polygon")+ scale_fill_gradient(low="blue", high="red")