# Map and bubble plots in R by Catrina Loucks #60

Closed
opened this Issue Jan 14, 2016 · 6 comments

Projects
None yet
5 participants

## Details

Learn about maps and bubble plots in R using the ggmap packages.

Where: Simon Fraser University, Burnaby Campus, Library Research Commons
When: 11:30 am - 12:30 pm, Monday, March 14, 2016

Prerequisite knowledge: Entry level R
Dependencies: R

Data: https://raw.githubusercontent.com/cloucks/ggmap_tutorial/master/worm_strains.csv
Cheatsheet: https://github.com/cloucks/ggmap_tutorial/blob/master/ggmapCheatsheet.pdf
Notes: https://github.com/cloucks/ggmap_tutorial/blob/master/ggmap_tutorial.Rmd
Video:

### bretshandro commented Mar 31, 2016

 Is it possible to add pie charts to a map using ggmap?

### ttimbers commented Apr 1, 2016

 @cloucks do you have an answer to @bretshandro's question?
Collaborator

### SimonGoring commented Apr 1, 2016

 It looks like it's possible, but a bit complicated.
Collaborator

### cloucks commented Apr 1, 2016

 @SimonGoring I've never tried that, but the link you found looks like a good place to get started!

### bretshandro commented Apr 1, 2016

 Thanks! I also found this if anyone else is looking: ``````library(ggplot2) library(dplyr) library(ggmap) library(grid) ukraine <- qmap(location = 'ukraine', fullpage = TRUE) n <- 10 fake_data <- factor(gl(3, n, label = c('a','b','c')))[sample(3*n,.50*3*n)] f_df <- data.frame(x = factor(1), y = fake_data) %>% group_by(y) %>% summarise(count = n()) pie <- ggplot(data = f_df, aes(x="", y = count, fill = y)) + geom_bar(width = 1, stat="identity") + coord_polar(theta = 'y') + theme_nothing() vplayout <- function(x, y) viewport(layout.pos.row = x, layout.pos.col = y) grid.newpage() pushViewport(viewport(layout = grid.layout(19,19))) print(ukraine, vp = vplayout(1:19, 1:19)) print(pie, vp = vplayout(10, 10)) ``````
Collaborator

### cloucks commented Apr 1, 2016

 @bretshandro cool! Thanks for sharing!