Нужна дальнейшая работа / исследование в макете, но вот подход.
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-20 Представить пакет (v0.2.1)