2012-07-21 14 views
6

ggmap i aşağıdaki gibi enter image description hereggplot görüntüyü kaydederken &

bakmak ggsave işlevini kullanarak bir görüntü kaydetmiş ama bu enter image description here

 al1 <- get_map(location = c(lon = -86.304474, lat = 32.362563), zoom = 11, maptype = 'terrain') 

     lon<--86.304474 
     lat<-32.362563 
     df<-data.frame(lon,lat) 
     a+ggplot(df) 
     ggmap(al1)+geom_point(data=df,aes(x=lon,y=lat),size=2) 

gibi çıkış ı kaldırılan x çalıştı istiyorum ve y ekseni değerleri ancak problemin görüntüde panelde beyaz arka plan var ama ben sadece görüntüyü istiyorum.

cevap

4

ggmap() işlevinde extent = "device"'a ihtiyacınız vardır. Daha fazla seçenek için bkz. ?ggmap::ggmap.

Aşağıdakiler istediğiniz sonucu verecektir.

library(ggmap) 
al1 <- get_map(location = c(lon = -86.304474, lat = 32.362563), zoom = 11, maptype = 'terrain') 

lon<--86.304474 
lat<-32.362563 
df<-data.frame(lon,lat) 
     #a+ggplot(df) # Not sure what you intend here 
ggmap(al1, extent = "device")+geom_point(data=df,aes(x=lon,y=lat),size=2)