Skip to content
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

Support for long-form data #13

Open
rjake opened this issue May 10, 2018 · 1 comment
Open

Support for long-form data #13

rjake opened this issue May 10, 2018 · 1 comment

Comments

@rjake
Copy link

rjake commented May 10, 2018

Very cool to find this package as I'm trying to make some maps with proportional pie charts. Is it possible to get this to use data that has a categorical variable in single column? The example below should generate a reproducible example (although not on a map)

library(tidyverse)
library(scatterpie)

iris_pie <-
    iris %>%
    mutate(Species = as.character(Species),
           x = ntile(Petal.Length, 4),
           y = ntile(Sepal.Width, 4)) %>% 
    group_by(Species, x, y) %>% 
    summarise(n = n()) %>% 
    group_by(x, y) %>% 
    mutate(total = sum(n)) %>% 
    ungroup()

ggplot(iris_pie) +
    geom_point(aes(x, y, size = total))

ggplot() +
    geom_scatterpie(data = iris_pie, aes(x, y, radius = total)) #slice = n??

I would like to see these split into sections by the various Species represented.

make_pies

The data looks like this
pie_df

@timcashion
Copy link
Contributor

Seconded!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants