library(mlbench) ## this package has a smiley function
n <- 1e5 ## number of points
p <- mlbench.smiley(n,sd1 = 0.4, sd2 = 0.4) ## make a smiley :-)
x <- p$x[,1]; y <- p$x[,2]
par(mfrow = c(1,2)) ## plot side by side
plot(x,y) ## left plot, regular scatter plot
smoothScatter(x,y) ## right plot, smoothed scatter plot
每月的第一天:
date('Y-m-01');
hexbin软件包(由@Dirk Eddelbuettel 建议)用于同样的目的,但是 smoothScatter()的优点是它属于 graphics软件包,因此是标准 R 安装的一部分。