ggmap

plot ggmap image over raster

為{幸葍}努か 提交于 2019-12-24 11:29:32
问题 I'm trying to plot a map from ggmap in front of a raster. This map has a lot of white area, so I wanted to make the white area transparent so I can plot the remaining elements on top of a colorful raster, using ggplot. Here is the map: Fulanus_bbox <- c(left = 17.250000, bottom = -3.916667, right = 36.916667, top = 8.416667) Fulanus_big <- ggmap::get_map(location = Fulanus_bbox, source = "stamen", maptype = "toner-lite") map <- ggmap::ggmap(Fulanus_big) map All I could think of were this two

Trying to explore ggmap following paper by Kahle and Wickham: I need GeomRasterAnn?

泪湿孤枕 提交于 2019-12-24 10:49:23
问题 ggmap looks like an excellent package, based on a paper published by David Kahle and Hadley Wickham, "ggmap: Spatial Visualization with ggplot2", The R Journal Vol. 5/1, June 2013, https://journal.r-project.org/archive/2013-1/kahle-wickham.pdf I am using the code published in this article to learn about the package and compare it to RShiny leaflet maps. I started two lines of code on the second page of the article in pdf format, just above Figure 2. There is no formal list of library()

Draw Point on Map Without Border

邮差的信 提交于 2019-12-24 02:54:35
问题 library(ggplot2) library(ggmap) data <- read.table(file = "data.txt", sep = ",", col.names = c("lat", "lon", "place_name"), fill=FALSE, strip.white=TRUE) # getting the map mapgilbert <- get_map(location = c(lon = mean(data$lon), lat = mean(data$lat)), zoom = "auto" , maptype = "roadmap", scale = 2, color = "bw") # plotting the map with some points on it ggmap(mapgilbert, extent = "device") + geom_point(data = data, aes(x = lon, y = lat, fill = place_name), size = 0.5, shape = 22) + guides

Error: Aesthetics must be either length 1 or the same as the data (4)

不羁岁月 提交于 2019-12-23 23:49:11
问题 I am working with ggmap . the goal is to plot coordinate points on the map and label the points with their names. I have data frame with name, longitude and latitude. The data looks like: df <- structure(list(Station.Area = c("Balbriggan", "Blanchardstown", "Dolphins Barn", "Donnybrook", "Dun Laoghaire", "Finglas"), Latitude = c(53.608319, 53.386813, 53.333532, 53.319259, 53.294396, 53.390325), Longitude = c(-6.18208, -6.377197, -6.29146, -6.232017, -6.133867, -6.298401)), .Names =c("Station

Merge separate size and fill legends in ggplot [duplicate]

混江龙づ霸主 提交于 2019-12-23 19:04:28
问题 This question already has answers here : How to combine scales for colour and size into one legend? (2 answers) Closed last year . I'm plotting point data on a map and would like to scale point size and fill to another column. However, ggplot produces two separate legends for size and fill, where I only want one. I have looked at several answers to the same problem, e.g. this one, but cannot understand what I'm doing wrong. My understanding ist that if both aesthetics are mapped to the same

Can you plot a table onto a ggmap similar to annotation_custom method for non- Cartesian coordinates

孤街浪徒 提交于 2019-12-23 18:10:40
问题 Hey guys I have been playing around with ggplot2 a bunch and found Adding table within the plotting region of a ggplot in r I was wondering is there any method for this for plotting using non cartesian coordinates, eg if map coordinates were used for the positioning of the table. I had some maps and thought it would be cool if they could have their corresponding data in a table for points to show more detail. If anyone knows a work around for annotation_custom for non cartesian coordinates it

R ggmap: Why can I create rectangular maps using the filename attribute, but not use them in a plot?

荒凉一梦 提交于 2019-12-23 08:37:20
问题 I would like to create a world map in R. I'm somewhat familiar with ggmap , so I tried something like this: ggmap(get_googlemap(center=c(83,25), zoom=1, scale=4, filename="world", size=c(640,300))) It does work fine as far as the world.png is concerned. I was actually quite happy to have found a workaround for ggmap 's "can't show anything above 80° latitude" issue, due to which it's more or less impossible to create maps of the whole world. However, in R itself, that is in the plots, the map

How to plot regions in a country, each shaded by some corresponding value

旧时模样 提交于 2019-12-23 05:04:23
问题 In particular I have a set of distinct regions in India, each with a "marketshare" value. regions <- data.frame(Region=c("TELANGANA", "TAMIL NADU", "JAMMU & KASHMIR"), Marketshare=c(.25, .30, .15)) regions Region Marketshare 1 TELANGANA 0.25 2 TAMIL NADU 0.30 3 JAMMU & KASHMIR 0.15 I can plot India using ggmap real easily using library(ggmap) map <- get_map("India", zoom=6, maptype="toner-lite") ggmap(map) But how can I specifically include the regions in my dataset and shade each of them

Density count in heatmaps

北城余情 提交于 2019-12-22 09:19:06
问题 I have a problem with my heatmap, which displays the density LEVEL, but doesn't say anything about the density count. (how many points are in the same area for example). My data is divided in more columns, but the most important ones are: lat,lon. I would like to have something like this, but with "count" : https://stackoverflow.com/a/24615674/5316566, however when I try to apply the code he uses in that answer, my maximum-"level" density doesn't reflect my density count.( Intead of 7500 I

Overlay multiple data with 2D density using different colours onto ggmap

北城以北 提交于 2019-12-22 01:40:20
问题 I feel like I've been endlessly searching for a solution to this and cannot find one anywhere. Basically, I need to overlay coloured contour maps as different layers (with different colours) onto a ggmap and cannot get this to work for my life. What I'm trying to do is take the example illustrated here: Overlay two ggplot2 stat_density2d plots with alpha channels only instead of mapping this onto a ggplot(), map it onto a ggmap(). I've read here: ggmap with geom_map superimposed that part of