Are you sure you meant to mention me and not @cpad0112? They provided the solution, not me.
• 0 views
•
link
Hi there,
I like to prepare a grouped boxplot for multiple columns (T1 to T6) from DF below. That can show high and low expression at each time point (T1 to T6). The R script I am using shows only one separate plot at a time e.g. T1 for Exp (High and Low). Any suggestions on how I can combine all columns (T1 to T6) to represent in one plot.
ggplot(DF, aes(x=Exp, y= T1, fill=Exp)) +
geom_boxplot()+
labs(x="T time point", y= "Expression")
DF
Exp T1 T2 T3 T4 T5 T6
High 0.23 0.64 0.00 0.09 0.00 0.36
High 0.12 0.00 0.32 0.05 0.00 0.56
Low 0.01 0.47 0.00 0.41 0.28 0.17
High 0.12 0.04 0.29 0.05 0.13 0.49
Low 0.15 0.00 0.24 0.12 0.00 0.59
edited: Thanks to cpad0112,
Your reply was very helpful in solving my issue. For the box plot, I just need to include geom_boxplot().
Thank you!
gather(df, "time","values", -Exp) %>%
ggplot(aes(time,values, fill=Exp, group=Exp))+
geom_boxplot()+
labs(x="time", y= "value")
Are you sure you meant to mention me and not @cpad0112? They provided the solution, not me.
Log in to answer this question.
like this?
or like this?
I'm surprised OP's data made sense to you - they seem to have many-to-many mappings between time and high/low exp. How one time point can have multiple highs/lows is something I don't get.