YuLab-SMU / scatterpie

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

Changing radius in ggmap #8

Closed hditt33 closed 6 years ago

hditt33 commented 6 years ago

Hi! I am using your package in combination with ggmap and I really like it. I only have a problem that when I adjust the radius the pies disappear completely. Is the radius change not compatible with ggmap somehow? If so, is there another way to change the size of the pies?

Best, Hannes

GuangchuangYu commented 6 years ago

any reproducible example?

hditt33 commented 6 years ago

Thank you for the quick reply!

Here is an example:

library(ggplot2) library(ggmap) library(scatterpie)

data=data.frame(lat=c(52,52,51.5),long=c(4.1,5.5,6),radius=c(5,10,13),A=c(0.2,0.2,0.2),B=c(0.8,0.8,0.8))

map=get_map(location=c(3,50,7,54),source="google")

ggmap(map)+geom_scatterpie(data=data,aes(x=long,y=lat),cols=c("A","B")) # without radius

ggmap(map)+geom_scatterpie(data=data,aes(x=long,y=lat,r=radius),cols=c("A","B")) # with radius

GuangchuangYu commented 6 years ago

the value is just too large, try:

ggmap(map)+geom_scatterpie(data=data,aes(x=long,y=lat,r=radius/100),cols=c("A","B"))
hditt33 commented 6 years ago

Great! Thank you very much!