Построение карты Google с ggplot в R
Я пытаюсь построитьGoogle Map это делается с помощью пакета RgoogleMaps и объединяется с ggplot. В конечном счете, я хочу показать общую численность населения, используяgeom_point
немного похоже на картинку ниже, однако я пытаюсь сосредоточиться на регионе Монтгомери из-за чрезмерного заговора.
Я разочарован, потому что я не могу построить свою запрашиваемую карту в R. Я попробовал несколько пакетов, таких какread.jpeg
а такжеpng
но это не сработало.
R коды:
<code>#query google map al1 <- GetMap(center=c(32.362563,-86.304474), zoom=11, destfile = "al2.jpeg", format="jpg",maptype="roadmap") #load only specific states alabama <- subset(all_states, region %in% c("alabama")) #population p1 <- ggplot() p1 <- p1 + geom_polygon(data=alabama, aes(x=long, y=lat, group=group), colour="white", fill="grey10") p1 <- p1 + geom_point(data=quote, aes(x=IntPtLon, y=IntPtLat, size=TotPop, color=TotPop),colour="coral1") + scale_size(name="Total Pop") </code>
EDIT:
Вот мой грубый результат. Я все еще хочу:
Change the scale of dots' size because they seem rather small on the map. Make dots transparent or not-filled so that the map is still visible.<code>al1 <- get_map(location = c(lon = -86.304474, lat = 32.362563), zoom = 11, maptype = 'terrain') al1MAP <- ggmap(al1)+ geom_point(data=quote_mgm, aes(x=IntPtLon, y=IntPtLat, size=TotPop)) </code>