I'd wondering if someone could please offer me a suggestion on how to sort out my shaded error for each line in this radar plot? I've tried several different approaches but am not getting what I want.
library(ggplot2)
library(scales)
# Make some data
Group.no <- 3
Group.names <- c("1","2","3")
Metric.no <- 4
Metriclist <- c("M1", "M4", "M6","M8")
Metric <- c(rep(c(Metriclist), each = Group.no))
Group <- c(rep(c(Group.names), times = Metric.no))
Mg <- c(87.7, 93.8, 72.5, 190.3, 170.9, 138.4, 283.2, 248.7, 196.5, 340.6, 307.9, 240.9)
d <- data.frame(Metric, Group, Mg)
d$lowCI <- Mg-8
d$highCI <- Mg+8
# Plot data
Plot <- ggplot(d, aes(x = Metric, y = Mg, group = Group)) +
geom_polygon(aes(group = Group, colour = Group), fill = NA, size = 1.1) +
geom_ribbon(aes(x=Metric,y=Mg,ymin=lowCI,ymax=highCI, group = Group, fill=Group), alpha=.3) +
coord_polar(start = -((180/Metric.no)*(pi/180)))+
theme_light()
Plot
As you can see, the geom_ribbon isnt plotting the lower and upper CI's in line with geom_polgyon. I am currently at the peak of my knowledge on this. Is anyone able to offer a suitable fix so that the shaded CI's track the polygon please so that both are straight lines?
Thanks in advance for any solutions!