Question: I am trying to generate a plot similar to the image below, where I have five categories, each represented as a bubble. The size of the bubbles reflects the numerical value of each category. Additionally, the bubbles are arranged in a flower-like structure.
Here is an example of the image I want to replicate
I have tried using ggplot2 in R and matplotlib in Python, but I am struggling to get the exact arrangement and bubble sizing.
Here's the data I am using:
# Data in R
data <- data.frame(
category = c("Metabolism", "Lipid metabolism", "AMPK signaling pathway",
"PPAR signaling pathway", "Lipid biosynthesis proteins"),
value = c(37, 17, 8, 6, 6)
)
Any suggestions on how to achieve this plot? Should I use custom geometry for this, or is there a simpler approach?
Thanks for your help!
An approximation using ggforce::stat_bspline
:
library(dplyr); library(ggplot2)
petals = 5
petal_angle = 360/petals
data |>
mutate(petal = row_number(),
theta0 = petal * petal_angle) |>
reframe(theta = theta0 + c(0, -petal_angle/2, 0,
petal_angle/2, 0),
r = value^0.5 * c(0, 0.6, 1, 0.6, 0), .by = c(category, value, petal, theta0)) |>
ggplot(aes(theta, r + 0.1, group = petal, fill = petal |> as.character())) +
ggforce::stat_bspline(geom = "area", n = 1000) +
guides(fill = "none") +
coord_radial() +
theme_void()