ggmap

Draw curved lines in ggmap, geom_curve not working

為{幸葍}努か 提交于 2019-12-03 13:21:00
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 2 Almere 11281 100841.42 930 0.05006999 0.025985067 52.39447 5.282043 3 Amersfoort 7719 67663.30 1198 0

geom_text not working when ggmap and geom_point used

匆匆过客 提交于 2019-12-03 12:53:53
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,vjust=0)) p <- p + labs(title="Monitoring stations ") p ggsave("plot.pdf") Here when I use geom_text then

ggmap route finding - doesn't stay on roads

帅比萌擦擦* 提交于 2019-12-03 10:20:07
问题 I am trying to map a route using the route() function in ggmap. My problem is that the route doesn't stay on the roads. Is there something that my route_df <- route(origin, destination, structure = "route") code is missing? Or is there an alternative function that can be used to accomplish this? Sample code: install_github("rstudio/leaflet") library(ggmap) library(leaflet) way1txt <- "Tinsletown, Vancouver, BC" way2txt <- "Science World, Vancouver, BC" route_df <- route(way1txt, way2txt,

How to draw ggmap with two different administrative boundaries?

走远了吗. 提交于 2019-12-03 08:57:20
I am wondering how to draw a map using get_map and ggmap of any federal country (i.e. a country with provinces and counties). Any country, other than the US would be great. To make it look nice, fill the geom_polygon of counties (any fill), and provinces are empty polygons, only with its contours. So, basically, it is two overlapping ggmaps. You can get the shapefiles here: https://www.dropbox.com/s/4nl685t860x1e8r/municipios_br.zip rm(list = ls()) library(ggplot2) library(rgdal) library(ggmap) # READ SHAPEFILE OF BOUNDARIES Map <- readShapePoly("municipios_br.shp") head(as.data.frame(Map))

Plotting shape files with ggmap: clipping when shape file is larger than ggmap

那年仲夏 提交于 2019-12-03 08:13:30
I am having clipping problems when I try to combine ggmap with shape files. The example in Kahle and Wickham (2013: 158) works fine because the raster image from ggmap covers the entire shape file. Below is an example of what happens when I try to plot the shape file for U.S. states on a ggmap plot that covers a smaller area. The ggmap shows New York City and I want to overlay it with the borders for U.S. states (just as an example). The resulting map doesn't make any sense. The problem is that the shape file gets clipped and ggplot connects the unclipped points. Below is the code. The shape

R ggplot2/ggmap concentric circles as points

有些话、适合烂在心里 提交于 2019-12-03 07:41:33
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", "06478", "07839", "10090", "11559"), city = c("Portsmouth", "Guanica", "Sabana Seca", "Wareham", "Auburn"

ggmap stamen watercolor png error

自作多情 提交于 2019-12-03 06:48:12
I would really appreciate some help / ideas about a problem I am having with ggmap and stamen watercolor. I keep getting the same error message every time I try to create a stamen watercolor map: "Error in readPNG(destfile) : file is not in PNG format" Here are some examples of simple code that is returning this error: qmap("new-york", zoom=13, source="stamen", maptype="watercolor") or get_map(location='Auckland', source="stamen", maptype="watercolor", zoom=13) I am using r version: [Default] [64-bit] C:\Program Files\R\R-3.0.2 under windows 8 I realize a few people have posted about this same

Heatmap plot by value using ggmap

邮差的信 提交于 2019-12-03 04:47:53
问题 I am attempting to use ggmap to look at education scores by school. I created a coordinate list of all the schools and the individual student scores like so: score lat lon 3205 45 28.04096 -82.54980 8275 60 27.32163 -80.37673 4645 38 27.45734 -82.52599 8962 98 26.54113 -81.84399 9199 98 27.88948 -82.31770 340 53 26.36528 -81.79639 I first used the pattern from most of the tutorials that I worked through: http://journal.r-project.org/archive/2013-1/kahle-wickham.pdf http://www.geo.ut.ee/aasa

Is there a way to add a scale bar (for linear distances) to ggmap?

六眼飞鱼酱① 提交于 2019-12-03 03:52:57
问题 Not that it's critical to my question, but here is my plot example, on top of which I'd like to add a scale bar. ggmap(get_map(location = "Kinston, NC", zoom = 12, maptype = 'hybrid')) + geom_point(x = -77.61198, y = 35.227792, colour = "red", size = 5) + geom_point(x = -77.57306, y = 35.30288, colour = "blue", size = 3) + geom_point(x = -77.543, y = 35.196, colour = "blue", size = 3) + geom_text(x = -77.575, y = 35.297, label = "CRONOS Data") + geom_text(x = -77.54, y = 35.19, label = "NOAA"

Plotting google map with ggplot in R

蓝咒 提交于 2019-12-03 01:45:25
问题 I am trying to plot Google map that is queried using RgoogleMaps package and combine it with ggplot. Ultimately, I want to show total population using geom_point , somewhat similar to the picture below however I am trying to concentrate on Montgomery region because of over-plotting. I am frustrated because I cannot plot my queried map in R. I tried a couple of packages such as read.jpeg and png but it didn't quite work out. R codes: #query google map al1 <- GetMap(center=c(32.362563,-86