Hello stackoverflow community, I have a question regarding coding for ggplot. Here is my code, data format and output at the moment and below is my question.
Data format:
ID time var1 var2 var3
a 1 2 3 4
a 5 6 7 8
b 9 11 12 13
b 14 15 16 17
c . . . .
c . . . .
and so forth
Code:
gg1 <- ggplot() + geom_line(aes(x=TIME, y=Var1, col="red"), FILE) +
geom_line(aes(x=TIME, y=Var2, col="blue"), FILE) +
geom_point(aes(x=TIME, y=Var3), Model_20160806) + facet_wrap( ~ ID)+
xlab("Time (Hr)") + ylab("Concentration (ng/ml)") + ggtitle("x")
I have been struggling in making the plots in the right format and any help would be very much appreciated.
As you can see, the col="red/blue" is displayed as the legend rather than the color? Is there a way to fix it?
How do I add legends for Var1, Var2, Var3 on the bottom of the output?
I have tried adding , facet_wrap( ~ ID, ncol=3) into the code but it doesn't work and provided a null. Is there a way to fix this?
Since there are a lot of cell samples, is there a way to make the graphs onto multiple pages so the graphs are visible and interpretable
Lastly, for better visualization of the transfection data, I tried using
gg1+theme_bw()
, but this does not work.