Here is what I have so far. But I am not able to add a title.
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(ggplot2)
contamination <- c('Very High', 'High', 'Intermediate', 'Low')
percentage <- c(50, 20, 5, 25)
label <- c('50% Very high', '20% High', '5% Intermediate', '25% Low')
df <- data.frame(contamination, percentage, label,
stringsAsFactors = FALSE)
df %>%
mutate(contamination = factor(x = contamination,
levels = contamination), # ideally you should specify the order explicitly
label = factor(x = label,
levels = label)) %>% # same as above note
ggplot(mapping = aes(x = 2,
y = percentage,
fill = label)) +
geom_bar(width = 1,
stat = "identity") +
coord_polar(theta = "y",
start = 0,
direction = -1) +
theme_void() +
theme(legend.title = element_blank(),
legend.text = element_text(size = 20,
color = "#58585A")) +
scale_fill_manual(values = c('blue', 'red', 'black', 'green')) +
annotate(geom = "text",
x = 0,
y = 0,
label = " ",
colour = "#009999",
size = 14)