New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map and bubble plots in R by Catrina Loucks #60

Closed
ttimbers opened this Issue Jan 14, 2016 · 6 comments

Comments

Projects
None yet
5 participants
@ttimbers

ttimbers commented Jan 14, 2016

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


Etherpad: https://etherpad.wikimedia.org/p/2016-03-14-SFU
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:

@ttimbers ttimbers changed the title from Map and bubble plots in R by Catrina Louks to Map and bubble plots in R by Catrina Loucks Jan 14, 2016

@ttimbers ttimbers added the workshop label Feb 25, 2016

@bretshandro

This comment has been minimized.

Show comment
Hide comment
@bretshandro

bretshandro Mar 31, 2016

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

bretshandro commented Mar 31, 2016

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

@ttimbers

This comment has been minimized.

Show comment
Hide comment
@ttimbers

ttimbers Apr 1, 2016

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

ttimbers commented Apr 1, 2016

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

@SimonGoring

This comment has been minimized.

Show comment
Hide comment
@SimonGoring

SimonGoring Apr 1, 2016

Collaborator

@cloucks, I found this:
http://rgraphgallery.blogspot.com/2013/04/rg-plot-pie-over-google-map.html

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

Collaborator

SimonGoring commented Apr 1, 2016

@cloucks, I found this:
http://rgraphgallery.blogspot.com/2013/04/rg-plot-pie-over-google-map.html

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

@cloucks

This comment has been minimized.

Show comment
Hide comment
@cloucks

cloucks Apr 1, 2016

Collaborator

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

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

This comment has been minimized.

Show comment
Hide comment
@bretshandro

bretshandro 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))

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))
@cloucks

This comment has been minimized.

Show comment
Hide comment
@cloucks

cloucks Apr 1, 2016

Collaborator

@bretshandro cool! Thanks for sharing!

Collaborator

cloucks commented Apr 1, 2016

@bretshandro cool! Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment