Hi have an experiment which consists of three variables, and I would like to plot them all on a single plot.
This is my df:
AB <- data.frame(block=c(\
Is this what you mean?
p_all <- ggplot(AB, aes(x=prime,y=RT,group=interaction(familiarity,block))) +
geom_line(aes(linetype=familiarity,color=block))
Data used:
AB <- structure(list(block = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L), .Label = c("A", "B"), class = "factor"), familiarity = structure(c(1L,
1L, 2L, 2L, 1L, 1L, 2L, 2L), class = "factor", .Label = c("fam",
"unfam")), prime = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L
), class = "factor", .Label = c("P", "UP")), RT = c(570.6929,
628.7446, 644.6268, 607.4312, 556.3581, 645.4821, 623.5624, 604.4113
)), .Names = c("block", "familiarity", "prime", "RT"), row.names = c(NA,
-8L), class = "data.frame")
IF you have different datasets for those variables, then you can specify the data
ggplot()+
geom_line(data=A, aes(x=prime, y=RT, group=familiarity,linetype=familiarity), size=1) +
geom_line(data=B, aes(x=prime, y=RT, group=familiarity,linetype=familiarity), size=1)+
expand_limits(y=c(500,650))