Open dramanica opened 3 years ago
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?
@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).
Bummer. I love this package, but this error is forcing me back into base R. Thanks for looking into it, anyway!
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()
@xiangpin pls incorporate this feature (using .id
internally) to the geom_scatterpie
layer.
In some instances, ovelapping pies are clipped incorrectly. Here is a simple reproducible example: