ggmap

ploting ggmap with geom Points (lat_long) annotated 1 to19. Points data is in CSVfile

亡梦爱人 提交于 2019-12-13 23:04:45
问题 I am plotting with ggmap and ggplot2 using geom_point . I want to add annotation text (i.e., 1 to 19) close to the points as well. Here is my code: setwd("../Documents/MAPS") library(ggplot2) library(mapproj) library(maps) library(maptools) library(rgdal) library(ggmap) library(sp) bdl_sites <- get_map(location =c(lon = 34.832, lat = 0.852), colour = "colour", source = "google", maptype = "terrain", zoom = 9) save(bdl_sites, file = "bdl_sites.rda") load(file = "bdl_sites.rda") BDL_Org_Data

Layering a ggplot2 map onto ggmap satellite with bathymetry data

萝らか妹 提交于 2019-12-13 17:21:24
问题 Okay so I wish to plot a plain map onto the ggmap base so that the ocean shows the bathymetry data. library(maps) library(mapdata) library(ggplot2) library(ggmap) #pick out the base layer I want get.Peru<-get_map(location = c(left = -85, bottom = -20, right = -70, top = -5), maptype="satellite") #this is the layer i wish to put over the top coast_map <- fortify(map("worldHires", fill = TRUE, plot = FALSE)) peru_bathy_map <- fortify(get.Peru) gg <- ggplot() gg <- gg + geom_map(data=peru_bathy

Failure to geocode using the ggmap and Google Geocoding API in R; behind company firewall

笑着哭i 提交于 2019-12-13 06:20:41
问题 I am attempting to geocode addresses in R using the geocode() function in the ggmap package. I have done this on my personal computer relatively easily and want to attempt this on my work computer. Generally, I am supposed to register with Google, library the ggmap package, read-in my security key, and then I can use the geocode() function. But I get errors. See below: # Library package library(ggmap) # Set key file gmAPI <- "key_file.txt" # Read-in Google API key gmAPIKey <- readLines(gmAPI)

Adjust font size in map plots in ggmap

人走茶凉 提交于 2019-12-12 19:47:00
问题 I am trying to plot a number of points on a map of Germany, using the ggmap package, which works great. However, I would like to make some specific changes and do not know how to or if that is at all possible. To make the maps, I do the following (d is a data frame with longitudes and latitudes): map <- get_map(location = c(10.25828, 51.11484), zoom = 6, maptype = "terrain") p <- ggmap(map) p <- p + scale_x_continuous(limits = c(6.09500,14.95306)) + scale_y_continuous(limits = c(47.39889,55

ggmap Heatmap with value

半世苍凉 提交于 2019-12-12 19:05:25
问题 Can anyone help me with the ggmap (heatmap)? My data: val_Qtd <- c(34, 10, 11, 7, 55, 18, 33, 16, 16, 249) nom_State <- c("Distrito Federal","Bahia","Ceara","Espirito Santo","Minas Gerais","Parana","Rio de Janeiro","Rio Grande do Sul","Santa Catarina","Sao Paulo") lon <- c(-47.86447, -41.70073, -39.32062, -40.30886, -44.55503, -52.02154, -43.20940, -51.21770, -50.21886, -46.62918) lat <- c(-15.799765, -12.579738, -5.498398, -19.183423, -18.512178, -25.252089, -22.913948, -30.034632, -27

ggmap, using coord_cartesian pushes all points to the north

 ̄綄美尐妖づ 提交于 2019-12-12 18:22:42
问题 As the title says when I add coord_cartesian to my ggmap it moves all of my points up. Here's some data. pricedata<-structure(list(nodename = c("CIN.WABRIVR.2", "CIN.WHEATCTG1", "CONS.ADA", "CONS.ALCONA", "CONS.CADILAC", "CONS.CROTON", "CONS.GAYLORD1", "CONS.GRATIOT1", "CONS.GRAYLGY2", "CONS.GRAYLNG", "CONS.HARDY", "CONS.HILLMAN", "CONS.HODENPYL", "CONS.HOLL", "CONS.KALK", "CONS.KARN1", "CONS.KENCNTY1", "CONS.LANS", "CONS.LUDINGTN1", "CONS.MIPOWER1", "CONS.RENAIGEN1", "CONS.STRAITS", "CONS

How do I use the ggmap library's get_map function inside of knitr?

删除回忆录丶 提交于 2019-12-12 15:15:17
问题 All of my R code runs as expected in a standalone script. Once inside an R Markdown file the get_map() call breaks down. map <- get_map(location = 'minneapolis', zoom = 9) I get an error: label: unnamed-chunk-2 Warning in sink() : no sink to remove label: unnamed-chunk-2 Error in process_file(text) : Quitting from lines 53-64: Error in close.connection(con) : invalid connection Calls: knit -> process_file Execution halted knitr terminated with status 1 Any ideas why knitr and get_map aren't

Error: is.integer(group) is not TRUE while using ggmap in R

不羁的心 提交于 2019-12-12 12:27:28
问题 I am trying to plot some GPS locations on a map. I used "ggmap" library for this. While using ggmap command, I get below error- ggmap(mp) Error: is.integer(group) is not TRUE Here is code snippet: library(ggplot2) library(ggmap) mapgilbert = get_map(location = (Long=mean(as.numeric(datn$Long)),Lat=mean(as.numeric(datn$Lat))), zoom = 4,maptype = "satellite", scale = 2) ggmap(mapgilbert) Note : "datn" is data frame containing GPS locations in columns Lat and Long. I tried using locations like

R ggmap Error: object 'f' not found

a 夏天 提交于 2019-12-12 10:56:12
问题 After I install rnoaa packages, my ggmap package is not working. I couldn't even do the simple example: >library(ggmap) >qmap(location = "boston university") Error in get("f", environment(CoordMap$train)) : object 'f' not found Does anyone have the same problem? Thank you! 回答1: Reverting to ggplot v. 2.2.0 worked for me: devtools::install_github("hadley/ggplot2@v2.2.0") 回答2: Reinstall R and R Studio Library(devtools) devtools::install_github("dkahle/ggmap") devtools::install_github("hadley

How to prevent ggmap (with Stamen maps) from misaligning points and features latitudes at low zoom?

不羁的心 提交于 2019-12-12 10:00:03
问题 When using ggmap, Stamen maps and continental-level zooms (zoom=3), the point-latitudes do not align with the map. For example: library(ggmap) gc <- geocode('the white house') qmap('the white house', zoom = 3) + # looks good geom_point(aes(x = lon, y = lat), data = gc, colour = 'red') qmap('the white house', zoom = 3, source = 'stamen', maptype="toner") + # not so good geom_point(aes(x = lon, y = lat), data = gc, colour = 'red') This seems to have been and addressed defect for googlemaps and