Grouped barplot in ggplot2: based on three variables (group, time, protein)

Viewed 36

Maybe someone has run into someissue. I am trying to plot different proteins (e.g., CS, AMPK) in other type points (pre and post), and two different intervention groups (control, treatment). I plot a grouped barplot nicely based on group and time, but I cannot create a unique grouped barplot per protein.

My data has as columns the following variables: PID, time, group, protein_name, protein_content (in the plot named area)

I used the following code to plot a grouped barplot

ggplot(data, aes(group, area, fill=time)) + theme_classic() +
  geom_bar(position = position_dodge(), stat = "identity")

With the following output: enter image description here

How do I create a plot like the one above for each protein rather than using all the protein values as a unique value? I have 5 different proteins, so I would like to plot 5 different plots like the one above.

Thank you in advance! All help is very much appreciated :)

0 Answers
Related