【发布时间】:2018-04-21 19:56:34
【问题描述】:
我正在尝试使用 ggplot 将热图绘制到地图上(效果很好),但如果我限制轴,我的 geom_polygon 叠加层会以错误的方式连接这些点。
ggplot(2017.fixes, aes(x=Long, y=Lat) ) +
stat_density_2d(aes(fill = ..density..), geom = "raster", contour=F)+
scale_fill_distiller(palette="PuBu", direction=1) +
geom_polygon (data=map.df,aes(x=long, y=lat,group=group), color="grey50", fill="grey", na.rm=T) +
#xlim(-156.95, -156.4)+
#ylim(20.55, 21.05 )+
coord_fixed()
产生这个:
但如果我取消注释 xlim 和 ylim 我会得到:
它显然正确地切断了左岛,但没有切断其他两个岛,我也不知道为什么。
【问题讨论】: