用于鼠标单击数据的热图 - 情节图

时间:2014-03-16 20:24:11

标签: r plot heatmap

我有一大堆鼠标点击的x和y坐标。下面是这些坐标的简单散点图。

enter image description here

正如您所看到的,显然,有三个区域点击相对更集中。我想以反映咔嗒声相对浓度的方式绘制这些咔嗒声 - 例如,具有高咔嗒声浓度的区域中的圆圈相对较大或具有较暗的颜色。显然,一个简单的散点图并没有表明这一点。我尝试了以下post,但结果不是我想要的。

所以任何建议都将不胜感激。

1 个答案:

答案 0 :(得分:6)

这些对你有用吗?

## scatter
plot(quakes$long, quakes$lat)

enter image description here

library(hexbin)
plot(hexbin(quakes$long, quakes$lat))

enter image description here

library(ggplot2)
ggplot(quakes, aes(x = long, y = lat)) + stat_density2d(aes(alpha = ..level..), geom = "polygon")

enter image description here

ggplot(quakes, aes(x = long, y = lat)) + stat_density2d(aes(fill = ..density..), geom = "tile", contour = FALSE)

enter image description here

library(MASS)
filled.contour(kde2d(quakes$long, quakes$lat))

enter image description here