4
我无法在R.与ggmap/GGPLOT2地图结合z值与填充等高线图R/ggplot/ggmap
我的数据被规则地间隔开的纬度/经度坐标的顶部绘制填充等高线图表明降雨
> head(flood)
lat lon rain
1 22.51916 -105.9318 1.486188e-05
2 22.59956 -105.9318 1.735962e-05
3 22.67996 -105.9318 2.024598e-05
4 22.76037 -105.9318 2.357599e-05
5 22.84077 -105.9318 2.741153e-05
6 22.92117 -105.9318 3.182212e-05
获得底图与ggmap后,我试图overplot雨
map = ggmap(baseMap) +
geom_contour(data = flood, aes(x = lon, y = lat, z = rain)) +
scale_fill_continuous(name = "Rainfall (inches)", low = "yellow", high = "red")
充满轮廓这给我的
错误Error in unit(tic_pos.c, "mm") : 'x' and 'units' must have length > 0
如果我做
map = ggmap(baseMap) +
geom_contour(data = flood, aes(x = lon, y = lat, z = rain, fill = ..level..)) +
scale_fill_continuous(name = "Rainfall (inches)", low = "yellow", high = "red")
我得到这个阴谋没有实际的填充。
我一直努力遵循this post和 this post,但我无法得到它适合我的问题。我对ggplot/R知之甚少,但到目前为止,我已经能够蹒跚过去。 ..level ..是什么意思?
我认为this post可能是相关的,但我不能概括修复工作的轮廓图。
谢谢,这工作完美。你能解释一下......level ..从哪里来,或者它是如何设置的? – jjardel
您的z数据被分档以创建轮廓(每个圆柱1轮廓)。 '..levels..'指的是箱号,映射到该箱的z范围。 – jlhoward