I have a dataframe as below:
GR CYT EMT PRO
High 8 5 8
Low 8 2 2
High 6 2 10
High 5 7 4
Low 7 2 1
Low 5 10 4
High 6 3 5
Low 8 1 10
High 4 7 5
High 2 3 8
Low 3 2 7
Low 5 7 1
High 7 7 2
High 5 1 3
I want plot all the parameters in a figure using R. I want check relationship of three parameters CYT, EMT, PRO with GR.
df <- data.frame(
GR = c("High", "Low", "High", "High", "Low", "Low", "High", "Low", "High", "High", "Low", "Low", "High", "High"),
CYT = c(8, 8, 6, 5, 7, 5, 6, 8, 4, 2, 3, 5, 7, 5),
EMT = c(5, 2, 2, 7, 2, 10, 3, 1, 7, 3, 2, 7, 7, 1),
PRO = c(8, 2, 10, 4, 1, 4, 5, 10, 5, 8, 7, 1, 7, 3)
)
I have tried something like following:
# Melt the data to long format for better plotting
df_long <- reshape2::melt(df, id.vars = "GR")
# Create a grouped bar plot
ggplot(df_long, aes(x = variable, y = value, fill = GR)) +
geom_bar(stat = "identity", position = "dodge") +
labs(title = "Relationship of Parameters with GR",
x = "Parameter",
y = "Value") +
theme_minimal()
Are there any other way to represent the data?

You can use a boxplot to show the relationship between groups. And see how the averages of the groups change by changing the level from 1 to 2 and 3. This diagram is often used for hypothesis testing
ggplot(df_long, aes(x= variable, y = value, col = GR)) + geom_boxplot()
You can also study the interaction between H-L and groups.
ggplot(df_long, aes(col= variable, y = value, x = GR)) + geom_boxplot()