0

I would like to have only one time 'timepoint 0-1-2' with group 1 and 2 along each other per timepoint. In my graph group 1 and two are completely separated.

I am using the following code

ggplot(data2, aes(x = Timepoint, y = percentage_of_patients_CTCAE_1, fill = CTCAE_1)) + geom_bar(stat = "identity") +facet_grid(~ Group)

enter image description here

this is the data I am using

structure( list( Group = c(1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1), Timepoint = c(0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2), CTCAE_1 = c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2), percentage_of_patients_CTCAE_1 = c( 86.6666666666667, 66.6666666666667, 33.3333333333333, 86.6666666666667, 73.3333333333333, 73.3333333333333, 6.66666666666667, 20, 33.3333333333333, 6.66666666666667, 20, 13.3333333333333, 6.66666666666667, 6.66666666666667, 33.3333333333333 ) ), row.names = c(NA,-15L), class = c("tbl_df", "tbl", "data.frame") )

Student1
  • 1
  • 1
  • 1
    Could you please share some reproducible data using `dput`? – Quinten Apr 26 '23 at 14:58
  • Facet by `Timepoint` and map `Group` on `x`. For this and other options see e.g. https://stackoverflow.com/a/12715768/12993861 or https://stackoverflow.com/a/21410145/12993861 or https://stackoverflow.com/questions/65955368/making-a-bar-plot-with-stack-and-dodge-and-keep-the-dodged-bars-touching-one-an – stefan Apr 26 '23 at 15:24
  • Could you provide a reproducible example? – user1987607 Apr 26 '23 at 19:03

0 Answers0