I would like to make a clustered/grouped bar chart with ggplot in R. However, I do not know how to make such a bar chart in the way I prefer. On the x-axis, I want to place 'drugset' and on the y-axis 'percentage'.
Here is an example of the data from which I want to make a clustered bar chart:
I would like to make one clustered bar chart where subset 1 and 2 are clustered (standing next to each other) and subset 3 and 4 as well. I am also wondering how to the change the colours.
below we can define our data frame :
df <- data.frame(Drugset=c("Subset1","Subset2","Subset3","Subset4"),percent=c(58.63,76.25,27.27,30.43),cat=c("cat1","cat1","cat2","cat2"))
This is very helpful, thankyou!
Is there also a way to get the two bars of subset 1 and 2 (with the pink/orange colour) more grouped together without the space in between?