Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MJacobs1985/03443837c21cb38e86b9f3e41c6d033d to your computer and use it in GitHub Desktop.
Save MJacobs1985/03443837c21cb38e86b9f3e41c6d033d to your computer and use it in GitHub Desktop.
ggplot(dataset, aes(x=as.factor(ID))) +
geom_boxplot(aes(y=VO2i_methode1, fill="red"),alpha=0.5, color="black") +
geom_boxplot(aes(y=VO2i_methode2, fill="darkgreen"), alpha=0.5, color="black") +
scale_y_continuous("VO2 method 1 (red) & 2 (darkgreen)")+
theme_bw()+ theme(legend.position = "none")
ggplot(dataset, aes(x=as.factor(Meting))) +
geom_boxplot(aes(y=as.numeric(VO2i_methode1-VO2i_methode2))) +
theme_bw() + theme(legend.position = "none")
ggplot(dataset, aes(x=as.factor(ID))) +
geom_boxplot(aes(y=VO2i_methode1-VO2i_methode2, fill="purple"),alpha=0.5, color="black") +
scale_y_continuous("VO2 method 1 & 2 difference")+
theme_bw()+ theme(legend.position = "none")
obj1 <- xyplot(VO2i_methode1 ~ Tijdstip|ID, dataset, type = "l" , lwd=2, col="steelblue", scales="free")
obj2 <- xyplot(VO2i_methode2 ~ Tijdstip|ID, dataset, type = "l", lwd=2, col="#69b3a2", scales="free")
obj3 <- xyplot(VO2i_verschil ~ Tijdstip|ID, dataset, type = "l", lwd=2, col="#69b3a2", scales="free")
doubleYScale(obj1,obj3, add.ylab2 = TRUE, use.style=FALSE )
ggplot(dataset, aes(x=Tijdstip)) +
geom_line(aes(y=VO2i_methode1, group=1),color="red", alpha=0.5) +
geom_line(aes(y=VO2i_methode2, group=1),color="darkgreen", alpha=0.5) +
geom_line(aes(y=VO2i_methode1-VO2i_methode2, group=1),color="blue") +
scale_y_continuous("VO2",
sec.axis = sec_axis(~ . * VO2i_methode2, name="Difference",
breaks=seq(0,1,0.1)))+
facet_wrap(~ID, scales="free") +
theme_bw() + theme(legend.position = "none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment