#activate the package library(ggplot2) #load the dataframe type <- rep(c("O+", "A+", "B+", "AB+", "O-", "A-", "B-", "AB-"), 2) country <- c(rep("Norway", 8), rep("UK",8)) percentage <- c(33.2, 41.6, 6.8, 3.4, 5.8, 7.4, 1.2, 0.6, 37.0, 31.0, 8.0, 3.0, 11.0, 7.0, 2.0, 1.0) df <- data.frame(type, country, percentage) #stacked bars ggplot(df, aes(x=country, y=percentage, fill=type))+ geom_col() + scale_fill_viridis_d() #pie/donut chart ggplot(df, aes(x=country, y=percentage, fill=type))+ geom_col() + scale_fill_viridis_d() + coord_polar("y") #pie/donut chart without theme ggplot(df, aes(x=country, y=percentage, fill=type))+ geom_col() + scale_fill_viridis_d() + coord_polar("y") + theme_void() #pie/donut chart with country highlight ggplot(df, aes(x=country, y=percentage, fill=type, color=country))+ geom_col(size=.8) + scale_color_manual(values=c("red", "blue")) + scale_fill_viridis_d() + coord_polar("y") + theme_void() ################ #double donut chart with country highlight ggplot(df, aes(x=country, y=percentage, fill=type, color=country))+ geom_col(size=.8) + scale_x_discrete(limits = c(" ", "Norway","UK")) + scale_color_manual(values=c("red", "blue")) + scale_fill_viridis_d() + coord_polar("y") + theme_void()