ggmap

Get Map with specified boundary coordinates

喜你入骨 提交于 2019-11-27 19:07:48
I want to get a map with RgoogleMaps from R, with a specific coordinates boundary. What I can call is GetMap, and specify a center, I must add a zoom level. Everything works fine, except that I am not getting an image map bounded with the coordinates I choose. Here's an example: lat <- c(44.49,44.5) lon <- c(11.33,11.36) center = c(mean(lat), mean(lon)) zoom <- 14 mmap <- GetMap(center = center, zoom=zoom, maptype= "satellite", destfile = "m.png") The problem is that only the center is passed as a parameter, and thus the whole image I see is dependant on the zoom level. So, I cannot really

ggplot piecharts on a ggmap: labels destroy the small plots

孤人 提交于 2019-11-27 19:06:43
问题 My ggmap on which I would like small piecharts with labels is generated with the code: p <- get_googlemap( "Poland", maptype = "roadmap", zoom = 6, color = "bw", crop = T, style = 'feature:all|element:labels|visibility:off' #'feature:administrative.country|element:labels|visibility:off' or 'feature:all|element:labels|visibility:off' ) %>% ggmap() + coord_cartesian() + scale_x_continuous(limits = c(14, 24.3), expand = c(0, 0)) + scale_y_continuous(limits = c(48.8, 55.5), expand = c(0, 0)) I am

A way to access google streetview from R?

醉酒当歌 提交于 2019-11-27 16:47:44
问题 There is a very nice interface to google earth images available via ggmap . For example: ggmap::get_map(location = c(lon = -95.3632715, lat = 29.7632836), maptype ="satellite",zoom=20) will return a satellite map image from Google Maps/Earth. On Google Maps website if you zoom a bit more, it switches to streetview. Is there a similar way from R to get the streetview images? There does seem to be an API, but can't find anything analogous to the ggmap interface in R. 回答1: My googleway package

locator equivalent in ggplot2 (for maps)

杀马特。学长 韩版系。学妹 提交于 2019-11-27 15:37:20
问题 Note: This question is specific for mapping but I'd like to be able to use it when I plot in a standard Cartesian coordinate system. I love base graphics but also like ggplot2 for many things. One of my most used base functions for fine tuning a graph is locator(n) but this produces an error in ggplot2. library(ggplot2) county_df <- map_data('county') #mappings of counties by state ny <- subset(county_df, region=="new york") #subset just for NYS ny$county <- ny$subregion ggplot(ny, aes(long,

Making a zip code choropleth in R using ggplot2 and ggmap

女生的网名这么多〃 提交于 2019-11-27 14:41:27
问题 I am trying to make a choropleth of very simple data, and it's kind of a pain in the neck. I have the following zip codes in the Eastern USA. This is made up data but you get the idea. Zip Freq 11101 10 10014 15 11238 400 etc. for about 100 rows. Values of Freq range from 0-1000, and these are the ones I would like to use to determine the color of each zipcode. I would ideally also like the map to focus on the Eastern USA instead of the whole country. I want to make a choropleth with this

Getting a map with points, using ggmap and ggplot2

*爱你&永不变心* 提交于 2019-11-27 11:40:55
问题 I want a map with points (and other geom_* layers) on it. I get the map, but instead of the points all I get is a warning: Message d'avis : Removed 3 rows containing missing values (geom_point). Here is a reproducible exemple: library(ggmap) library(ggplot2) d <- data.frame(lat=c(50.659631, 50.607213, 50.608129), lon=c(3.09319, 3.011473, 3.031529)) Lille <- get_map("Lille,France", zoom=12) p <- ggmap(Lille) p <- p + geom_point(data=d, aes(lat, lon)) p Looking in the output of ggplot_build(p)

Barplots on a Map

倖福魔咒の 提交于 2019-11-27 08:47:24
I am trying to plot vertical bar plots over a map. I went through examples online but somehow not being able to. My data is currently in this format: University| Count | Category | lat | long Here is the code that I am trying execute: library(ggplot2) library(ggmap) library(ggsubplot) df1 <- data.frame( University = c(rep("University1", 4), rep("University2", 4), rep("University3", 4), rep("University4", 4)), Count = sample(1:10, 16, replace = T), Category = rep(c("A", "B", "C", "D")), lat = c(rep(10.902469, 4), rep(17.921959, 4), rep(18.606910, 4), rep(13.202366, 4)), long = c(rep(76.90020, 4

R geom_point and ggmap

霸气de小男生 提交于 2019-11-27 06:31:55
问题 I want to plot a ggmap in R, for example, of Australia and have a layer of data points with markers corresponding to the size specified by the following data: sitename lat lon sitenum Sydney -34 151 1 Melbourne -37 144 4 Adelaide -34 138 7 Here's my code, but it's not working... library(ggmap) map <- get_map(location = 'Australia', zoom = 4) mapPoints <- ggmap(map) + geom_point(aes(x = lon, y = lat, size = sitenum), alpha = .5) 回答1: You need to pass the points as the data argument to geom

Administrative regions map of a country with ggmap and ggplot2

时间秒杀一切 提交于 2019-11-27 06:02:24
I can make USA state level unemployment graph with the following code. library(XML) library(ggplot2) library(plyr) library(maps) unemp <- readHTMLTable('http://www.bls.gov/web/laus/laumstrk.htm', colClasses = c('character', 'character', 'numeric'))[[2]] names(unemp) <- c('rank', 'region', 'rate') unemp$region <- tolower(unemp$region) us_state_map <- map_data('state') map_data <- merge(unemp, us_state_map, by = 'region') map_data <- arrange(map_data, order) states <- data.frame(state.center, state.abb) p1 <- ggplot(data = map_data, aes(x = long, y = lat, group = group)) p1 <- p1 + geom_polygon

Plot coordinates on map

丶灬走出姿态 提交于 2019-11-27 05:05:56
问题 I am trying to plot my coordinates using R. I have tried already to follow different post (R: Plot grouped coordinates on world map ; Plotting coordinates of multiple points at google map in R) but I am not having much success with my data. I am trying to achieve a flat map of the world with my gps coordinate as colored dots (each area a specific color): area lat long Agullhas -38,31 40,96 Polar -57,59 76,51 Tasmanian -39,47 108,93 library(RgoogleMaps) lat <- c(-38.31, -35.50) #define our map