ggmap

Plotting multiple maps with ggmap

你说的曾经没有我的故事 提交于 2019-12-11 01:55:24
问题 I can plot a UK map with ggmap with a point like this: library(ggmap) UK_map <- get_map(location = c(-2.65, 53.7), zoom = 5, maptype = "hybrid") UK_map <- ggmap(ggmap=UK_map, extent = "device", legend = "right") UK_map + geom_point(data = data.frame(x = -1.81, y = 55.655), aes(x, y), size = 5) However, if I try to use Winston Chang's multiplot function, the point disappears. multiplot <- function(..., plotlist=NULL, cols) { require(grid) # Make a list from the ... arguments and plotlist plots

Using ggplot's ggmap function to superimpose two maps on top of each other

孤街浪徒 提交于 2019-12-10 17:36:30
问题 I am using ggmap to plot geom s on top of a map: Lat = 47.617736 Lon = -122.334244 map1 <- get_map(location = c(lon = Lon, lat = Lat), zoom = 12) map2 <- get.googlemap.with.style(center=c(lon = Lon, lat = Lat), zoom=12, scale = 2, size = c(640, 640), maptype = "roadmap", color = "color", format = "png8", style = Style1) ggmap(map1) + geom_point() Using style parameters for the Google maps api, I can download a second map, map2, with just streets and water features for the same region. Style1

Truncated Density Polygons with ggmap

喜欢而已 提交于 2019-12-10 15:15:44
问题 I am having trouble plotting density maps using R/ggmap. My data looks like this: > head(W) date lat lon dist 1 2010-01-01 31.942 -86.659 292.415 2 2010-01-10 32.970 -84.174 89.121 3 2010-01-17 31.000 -85.363 319.552 4 2010-01-17 31.457 -83.951 258.501 5 2010-01-17 31.073 -81.987 373.915 6 2010-01-17 33.210 -83.149 129.927 And I am plotting it using this: ggmap(atlanta.map, extent = "panel") + geom_point(data = W, aes(x = lon, y = lat)) + geom_density2d(data = W, aes(x = lon, y = lat)) + stat

R ggmap countour plot: Convert ..level.. to events per squared area of distance

半腔热情 提交于 2019-12-09 22:27:03
问题 Using the example in ggmap: Spatial Visualization with ggplot2, by David Kahle and Hadley Wickham of a filled contour plot of violent crimes (Figure 9 in the linked article), I would like to know if instead of ..level.. , how I could instead show average violent crimes per square (1000) kilometers as for me this would be much easier to interpret. Here is an extract of the code from that article: require(ggmap) violent_crimes <- subset(crime, offense != "auto theft" & offense != "theft" &

R Create a Spatial Bubble Plot That Overlays A basemap of the US and other spatial layers as needed

ε祈祈猫儿з 提交于 2019-12-09 19:41:58
问题 I'm trying to produce a nice bubble plot overlaid on top of a basemap of the US (i could import a shapefile if that is preferred but i've been using the R basemaps. library(ggplot2,sp,raster,maps,mapdata,maptools,ggmap,rgeos) myData = data.frame(name=c("Florida","Colorado","california","Harvard","Yellowstone"), lat=c(28.1,39,37,42,44.6), long=c(-81.6,-105.5,-120,-71,-110), pop=c(280,156,128,118,202)) Using this code below, that i adapted from another stack overflow post (Create bubble plot in

Select raster in ggplot near coastline

隐身守侯 提交于 2019-12-09 13:17:02
问题 So I have a map that is plotting air pressure in Catalonia: Here's a close up: I would now like to select all observations with air pressure above 97 kPa (dark blue) and create a new data frame with them for further analysis. Here's the tricky bit, I want to select observations that meet the altitude filter AAAAND are along the Mediterranean coast. Most observations above 97 kPa are along the Mediterranean coast but there are some outliers that are inland. In the end, I guess some sort of

Draw curved lines in ggmap, geom_curve not working

不羁岁月 提交于 2019-12-09 11:20:49
问题 I would like to make a map of the Netherlands with curved lines between cities. I have two dataframes number one called: df_verticles which contains 24 cities with their lat/lon combination. The second dataframe called: df i want to use to draw a curved line between lat/lon from combination to the lat/lon to combination. > head(df_vertices) city AmountSessions totalkWh AmountRFID scaledAmount scaledkWh Latitude Longitude 1 Alkmaar 13608 104554.68 1326 0.07139012 0.026941910 52.63903 4.755538

geom_text not working when ggmap and geom_point used

爷,独闯天下 提交于 2019-12-09 11:13:38
问题 HI I am using ggmap and gg_point function to show the measured data in an estuary. The code that I used is as follows: library(ggmap) al1 <- get_map(location = c(lon = -87.525, lat = 30.35), zoom = 12, maptype = 'terrain') lon<- c(-87.604474,-87.55) lat<- c(30.362563,30.35) label <- c("A","B") df<-data.frame(lon,lat,label) p <- ggmap(al1)+geom_point(data=df,aes(x=lon,y=lat,shape=label,label=label),size=3) p <- p + xlab("Longitude")+ylab("Latitude") p <- p +geom_text(aes(label=label, size=3

R-Geocoding with Address

落爺英雄遲暮 提交于 2019-12-09 07:59:02
问题 I have 32K lines of addresses for which I have to find long/latitude values. I'm using the code found here. I'm so very thankful for this person to creating it but I have a question: I'd like to edit it so that if the loop runs into an issue with the current row's address, it simply states NA in the Lat/Long fields and moves to the next one. Does anyone know how that may be accomplished? The code is below: # Geocoding a csv column of "addresses" in R #load ggmap library(ggmap) # Select the

R ggplot2/ggmap concentric circles as points

房东的猫 提交于 2019-12-09 06:15:32
问题 I am trying to plot some information that shows full population and then a subset of that population by location on a map. I've seen data visualizations that use concentric circles or 3-d inverted cones to convey this. I just can't figure out how to do it in ggplot / ggmap Here's a free hand version in Paint that shows a rough idea of what I'm looking to do: Here's a rough piece of data for an example: > dput(df1) structure(list(zip = c("00210", "00653", "00952", "02571", "04211", "05286",