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

Artefacts with overlapping pies #32

Open
dramanica opened this issue May 4, 2021 · 5 comments
Open

Artefacts with overlapping pies #32

dramanica opened this issue May 4, 2021 · 5 comments

Comments

@dramanica
Copy link

In some instances, ovelapping pies are clipped incorrectly. Here is a simple reproducible example:

df<-data.frame(lat=c(1,1.5),long=c(2,2.1),A=c(0.2,0.5),B=c(0.7,0.4),C=c(0.1,0.1))
ggplot()+geom_scatterpie(aes(x=long,y=lat),cols=c("A","B","C"),data=df,pie_scale=150)+coord_equal()

image

@alexkrohn
Copy link

alexkrohn commented Apr 4, 2022

I've found this same issue and haven't found a solution. From what I can tell it occurs because the colors are plotted sequentially instead of pies being plotted together (e.g. all green slices are plotted, then all red slices, then all blue slices, so the blues overlap the greens). I'm not sure how to remedy this.

@dramanica Did you find a solution to this?

@dramanica
Copy link
Author

@alexkrohn No, I am afraid I never did find a proper solution; swapping the order of the factor levels can help depending on how the colours overlap (but that's a hack that will only work under some circumstances).

@alexkrohn
Copy link

Bummer. I love this package, but this error is forcing me back into base R. Thanks for looking into it, anyway!

@dicorynia
Copy link

Adding an id column and using it for grouping solves this issue

df <- data.frame(id = c(1, 2), 
                 lat=c(1,1.5),
                 long=c(2,2.1),
                 A=c(0.2,0.5),
                 B=c(0.7,0.4),
                 C=c(0.1,0.1))

ggplot()+
  geom_scatterpie(data=df,
                  aes(x=long,y=lat, group = id),
                  cols=c("A","B","C"),
                  pie_scale=150)+
  coord_equal()

image

@GuangchuangYu
Copy link
Member

@xiangpin pls incorporate this feature (using .id internally) to the geom_scatterpie layer.

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

4 participants