R等高线图

时间:2017-01-20 19:56:01

标签: r ggplot2 contour

我在网格地图中有一组数据,每个网格都有空气污染物浓度。

x <- seq(1:12)
y <- seq(0.1,3,0.24)
set.seed(5)
z <- runif(length(x)*length(y),0,10)
data <- expand.grid(x,y)
data$z <- z
colnames(data)<-c("x","y","z")
p1<-ggplot(data)+
   aes(x = x, y = y, z = z, fill = z) + 
   geom_tile() + 
   coord_equal() +
   geom_contour(color = "white", alpha = 0.5) + 
   scale_fill_distiller(palette="Reds")+
   theme_bw()
print(p1)

contour plot

我们可以看到轮廓线,但填充颜色不像平滑轮廓图。

我在网站上尝试过一些例子,他们工作正常。我只是想知道,这是因为我对每个col和每个col都有相同的lat吗?任何建议如何解决?

0 个答案:

没有答案