在布局中需要进一步的工作/调查,但这里有一个方法。
library(packCircles)
图书馆(tidyverse)
SET种子(1)
dat<-dat a.frame(category=rep(c(“a”、“b”、“c”),每个=10),
ID= 1:30,
半径=圆形(RUNIF(30,最小值=0.5,最大值=3),2)
字符串因子=假)
#通过拆分、映射和重新组合为每个组创建布局
日期gg<-dat%>%
拆分(.$category)%>%
映射(~CircleProgressLayout(.x$radius,sizeType='radius'))%>%
imap_dfr(~CircleLayoutvertices(.x,npoints=50)%>%变异(category=0.y))
做某事
GGPROTH()+
几何多边形(data=dat.gg,aes(x,y,group=id,fill=category),colour=“black”,alpha=0.6)+
面包(~类别)+
缩放_fill_viridis_d()。+
主题_void()。+
主题(legend.position=“none”,plot.margin=单位(c(0,0,0,0),“cm”))+
COODIN等式()
< /代码>

created on 2018-11-20 by thereprex package(v0.2.1)。
布局,但这里有一个方法。
library(packcircles)
library(tidyverse)
set.seed(1)
dat <- data.frame(category = rep(c("A", "B", "C"), each = 10),
id = 1:30,
radius = round(runif(30, min = 0.5, max = 3), 2),
stringsAsFactors = FALSE)
#Create layouts for each group by splitting, mapping and recombining
dat.gg <- dat %>%
split(.$category) %>%
map(~circleProgressiveLayout(.x$radius, sizetype='radius')) %>%
imap_dfr(~circleLayoutVertices(.x, npoints=50) %>% mutate(category = .y))
#Do the thing
ggplot() +
geom_polygon(data = dat.gg, aes(x, y, group = id, fill = category), colour = "black", alpha = 0.6) +
facet_wrap(~category) +
scale_fill_viridis_d() +
theme_void() +
theme(legend.position="none", plot.margin=unit(c(0,0,0,0),"cm") ) +
coord_equal()

创建于2018-11-20reprex package(v0.2.1)