R语言如何画出多个变量的动态变化图
sample<-seq(1,14,by=1)
forehead<-c(249,189,128,111,184,233,313,120,151,196,135,157,145,218)
forearm<-c(176,28,136,87,145,109,151,63,101,95,121,98,97,102)
back<-c(95,51,55,51,58,77,121,37,39,49,66,58,49,85)
sweatgland<-data.frame(sample,forehead,forearm,back);
sweatgland
sample forehead forearm back 1 1 249 176 95 2 2 189 28 51 3 3 128 136 55 4 4 111 87 51 5 5 184 145 58 6 6 233 109 77 7 7 313 151 121 8 8 120 63 37 9 9 151 101 39 10 10 196 95 49 11 11 135 121 66 12 12 157 98 58 13 13 145 97 49 14 14 218 102 85plot(forehead~sample,pch=15,col="DarkTurquoise",ylim=c(0,400),ylab="Number of active sweat glands per cm2",main="Number of active sweat glands per cm2 in forehead, forearm and back")
points(sample,forearm,pch=16,col="DeepPink",cex=1)
points(sample,back,pch=17,col="RosyBrown",cex=1)
lines(forehead,col="DarkTurquoise",lty=1)
lines(forearm,col="DeepPink",lty=2)
lines(back,col="RosyBrown",lty=3)
legend(8,400,c("forehead","forearm","back"),col=c("DarkTurquoise","DeepPink","RosyBrown"),text.col=c("DarkTurquoise","DeepPink","RosyBrown"), pch=c(15,16,17),lty=c(1,2,3))