## Load libraries
library(dplyr)
library(tidyr)
library(ggplot2)
## Simulate raw data
set.seed(789)
plot_data <- data.frame(y = rnorm(10, 100, 30),
x = 1:10,
group = sample(size = 10,
x = c(1, 2, 3),
replace = TRUE),
A = round(runif(10, 3, 9), 2),
B = round(runif(10, 1, 5), 2),
C = round(runif(10, 3, 7), 2),
D = round(runif(10, 1, 9), 2))
head(plot_data)
## Create plot
p <- ggplot(data = plot_data)+
geom_pie_glyph(aes(x = x, y = y, radius = group),
slices = c('A', 'B', 'C', 'D'))+
labs(y = 'Response', x = 'System',
fill = 'Attributes')+
theme_classic()
p + scale_radius_continuous(range = c(0.2, 0.5))
q <- ggplot(data = plot_data)+
geom_pie_glyph(aes(x = x, y = y,
radius = as.factor(group)),
slices = c('A', 'B', 'C', 'D'))+
labs(y = 'Response', x = 'System',
fill = 'Attributes', radius = 'Group')+
theme_classic()
q + scale_radius_discrete(range = c(0.05, 0.2), unit = 'in',
name = 'Group')
q + scale_radius_manual(values = c(2, 6, 4), unit = 'mm',
labels = paste0('G', 1:3), name = 'G')
Run the code above in your browser using DataLab