有没有办法绘制geom_pie
一个geom_point
情节?具有共享变量(此处:位置)
我见过人们在地图上做馅饼,在 ggplot 的地图上绘制饼图
但我想知道是否有一些包或功能可以让你这样做?
这是我的数据和两个当前图:
data_point <- data.frame(
Location=(1:7),
Var1=c(13,8, 6,5,4,2,1),
Var2 = c(7,8,9,10,11,12,13))
data_pie <- data.frame(
Location=rep(1:7,5),
Group= c(rep("A",7),rep("B",7),rep("C",7),rep("D",7),rep("E",7)),
value=c(45.59,63.56,66.47,58.60,67.28,44.45,9.22,0.00,0.00,0.00,0.00,0.00,4.14,37.81,0.00,0.00,0.00,0.04,
0.03,25.15,34.58,52.86,35.61,24.66,26.13,18.98,12.71,6.61,2,1,9,15,14,14,12))
a<-ggplot(data_point, aes(Var1, Var2, label=1:7)) +
geom_point(size = 3, stroke = 2)+
theme_classic()
b<- ggplot(data_pie, aes(x="", y=value, fill=Group)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
facet_wrap(~Location)+ scale_fill_brewer(palette="Dark2")
ggarrange(a,b, nrow = 1)