YuLab-SMU / scatterpie

:art: scatter pie plot
https://cran.r-project.org/package=scatterpie
60 stars 15 forks source link

scatterpie shape changes with the map from ggmap #27

Open smallfishcui opened 4 years ago

smallfishcui commented 4 years ago

Hi,

I have been using the scatterpie package with ggmap package, aiming to show the genetic admixture on the map, here is my code: library(tidyverse) library(ggplot2) library(ggmap) library(scatterpie) register_google(key = "xxxxx", write = TRUE) d<-read.table("/Users/cuiwang/Desktop/map/Phmap.txt", header=TRUE) a<-get_googlemap(center = c(mean(d$lon), mean(d$lat)), zoom = 1) a<- ggmap(a) a + geom_scatterpie(aes(x=long, y=lat,r=2), data=d, cols=c("Usnat","Usland","Med","AU","CN","EU"), color="#252728", alpha=1)

However, I got a picture with the pie chart skewed, as if it is also projected in the same way of the map. Is there any solution for this? image

kfuku52 commented 3 years ago

I came across a similar problem in combining scatterpie with ggtree + cowplot. The orange pie charts in the middle were generated by scatterpie but its aspect ratio cannot be easily adjusted. I would appreciate it if anybody could tell me a solution to force the pie charts perfect circle. image

Kamouyiaraki commented 3 years ago

Hi I'm here with the same issue, hoping someone will see this to offer some insight!

PGmajev commented 3 years ago

This is also true when using geom_sf() and coord_sf()

martinpastoors commented 2 years ago

I have a similar issue trying to plot proportions on a map. This is using coord_quickmap(xlim=xlim, ylim=ylim): image If I use coord_equal, the problem disappears: image

madelynore commented 5 days ago

hi! I have this same issue. Has anyone figured out a solution to this problem?

GuangchuangYu commented 5 days ago

use +coord_equal().