ggmap

ggplot piecharts on a ggmap: labels destroy the small plots

我只是一个虾纸丫 提交于 2019-11-29 05:20:36
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 trying to plot my small ggplot piecharts on a ggmap following the answer R::ggplot2::geom_points: how

Plotting coordinates of multiple points at google map in R

吃可爱长大的小学妹 提交于 2019-11-29 04:15:38
问题 I wanted to plot the coordinates on a Google Map in the presence of point id: Sample of data: coordinates id 1 (7.1735, 45.8688) 2 2 (7.17254, 45.8689) 3 3 (7.17164, 45.8692) 4 4 (7.18018, 45.8716) 5 5 (7.17807, 45.8701) 6 6 (7.17723, 45.8692) 7 7 (7.17524, 45.8681) 8 8 (7.18141, 45.8718) 9 9 (7.1793, 45.8702) 10 10 (7.17836, 45.8707) 11 11 (7.17519, 45.8697) 12 12 (7.17938, 45.8708) 13 13 (7.17551, 45.8693) 14 14 (7.17684, 45.8694) 15 15 (7.18099, 45.8726) 17 16 (7.18015, 45.8725) 18 17 (7

Format latitude and longitude axis labels in ggplot

会有一股神秘感。 提交于 2019-11-29 02:54:02
问题 I have a ggplot map, for example: library(ggmap) ggmap(get_map()) I'd like the axis labels to be automatically labeled as N-S / W-E: in the above case, for example, instead of lon -95.4 it should show 95.4°E. I have tried to mess with the scales package and using scale_x_continuous and scale_y_continuous labels and breaks options, but I have not managed to make it work. It would be awesome to have a scale_y_latitude and scale_x_longitude . EDIT: Thanks to @Jaap 's answer I got to the

ggplot US state map; colors are fine, polygons jagged - r

送分小仙女□ 提交于 2019-11-29 02:27:50
I'm trying to plot a US map where each state is shaded by the count that it has. I've gotten the shading to work just fine. The problem I'm running into, however, is that the polygons look very jagged (I'm assuming something happened when I tried to merge the map_data('state') with my data frame of counts per state). My data frame before merging has 49 rows (Nevada was missing data in my set), and after merging has many more rows (expected for the long/lat items for the states) but the data appears to be copied correctly for each lat/long pair, so I'm unsure why the poly's are so jagged. Code:

A way to access google streetview from R?

邮差的信 提交于 2019-11-29 02:26:00
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. My googleway package has a google map widget (and also works with Shiny ). You'll need a valid Google API key to use it library

Applying revgeocode to a list of longitude-latitude coordinates

被刻印的时光 ゝ 提交于 2019-11-29 02:07:07
I'm trying to get the Zip codes of a (long) list of Longitude Latitude coordinates by using the revgeodcode function in the ggmap library. My question & data are the same as here: Using revgeocode function in a FOR loop. Help required but the accepted answer does not work for me. My data (.csv): ID, Longitude, Latitude 311175, 41.298437, -72.929179 292058, 41.936943, -87.669838 12979, 37.580956, -77.471439 I follow the same steps: data <- read.csv(file.choose()) dset <- as.data.frame(data[,2:3]) location = dset locaddr <- lapply(seq(nrow(location)), function(i){ revgeocode(location[i,], output

locator equivalent in ggplot2 (for maps)

瘦欲@ 提交于 2019-11-29 01:05:47
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, lat, group=group)) + geom_polygon(colour='black', fill=NA) locator(1) Now grid.locator() as pointed out

Plot circle with a certain radius around point on a map in ggplot2

被刻印的时光 ゝ 提交于 2019-11-28 21:29:45
I have a map with the 8 points plotted on it: library(ggplot2) library(ggmap) data = data.frame( ID = as.numeric(c(1:8)), longitude = as.numeric(c(-63.27462, -63.26499, -63.25658, -63.2519, -63.2311, -63.2175, -63.23623, -63.25958)), latitude = as.numeric(c(17.6328, 17.64614, 17.64755, 17.64632, 17.64888, 17.63113, 17.61252, 17.62463)) ) island = get_map(location = c(lon = -63.247593, lat = 17.631598), zoom = 13, maptype = "satellite") islandMap = ggmap(island, extent = "panel", legend = "bottomright") RL = geom_point(aes(x = longitude, y = latitude), data = data, color = "#ff0000") islandMap

Getting a map with points, using ggmap and ggplot2

主宰稳场 提交于 2019-11-28 18:22: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) I see a layer with NAs for x and y, but I do not get why the data from d is not considered. When using

Polygons nicely cropping ggplot2/ggmap at different zoom levels

点点圈 提交于 2019-11-28 18:21:24
I am playing with a spatial data set (mostly polygons over an area of a city) and I would like to produce different views, based on different levels of zoom. Everything is fine when I have the plot boundary box larger than the area that contains the polygons. But on a zoom in, some polygons get parts that are outside the boundary box and the output for those polygons is problematic : the points of the polygon outside the boundary box are not displayed, resulting in polygons that are not cropped at boundary box limits (as would be expected) but rather are not considered. the polygons are