简体   繁体   English

如何在R中的gmap图块上绘制tif

[英]How to plot tif over gmap tile in R

I want to plot a raster (.tif) over my gmap tile in R. It can be done with simple plot() function or with ggplot2 or with dismo gmap function. 我想在R中的gmap图块上绘制栅格(.tif)。可以使用简单的plot()函数或ggplot2或dismo gmap函数来完成。 I found several examples, but none of them is really working for me. 我找到了几个示例,但没有一个对我真正有用。 Here is the simpliest way I was able to understand: 这是我能够理解的最简单的方法:

r<- raster(whatever.tif)
g<-gmap()
plot(g)
plot(r, add= TRUE)

This displays the correct gmap tile, it plots the desired raster, BUT it overlays also a huge legend over the whole visualization, making it not useful anymore. 这将显示正确的gmap图块,绘制所需的栅格,但会在整个可视化效果上覆盖巨大的图例,使其不再有用。

From the question its obvious I am beginner. 从这个问题显而易见,我是新手。 Thanks for any help! 谢谢你的帮助!

Quick fix! 快速解决!

plot(raster(x), add=TRUE, legend=FALSE) 情节(raster(x),add = TRUE,legend = FALSE)

This will suppress your legend. 这将隐藏您的图例。 If you desire to add a legend later check out ?legend. 如果以后需要添加图例,请查看?legend。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM