我想将下面的情节制作成R。
到目前为止,我的编码是这样的:
maraqa <- c(84.8,68.9,84.9,92.5)
aqua <- c(75,65.1,79.4,82.3)
mar <- c(84.7,68.3,84.5,77.4)
x <- c("A", "B", "C", "D")
现在怎样?谢谢!
答案 0 :(得分:2)
这是一个解决方案......但请查看帮助页面以找出哪些参数控制什么......
maraqa <- c(84.8,68.9,84.9,92.5)
aqua <- c(75,65.1,79.4,82.3)
mar <- c(84.7,68.3,84.5,77.4)
# combine data as matrix
mat<-cbind(maraqa, aqua, mar)
rownames(mat)<-c("A", "B", "C", "D")
#define colours
coll<-c("red", "blue", "black")
matplot(mat, type="l", ylim=c(60, 95), ylab="y TBA", main="TBA", xlab="x TBA",
axes=FALSE, frame.plot=FALSE, col=coll, lty=rep(1,3))
# axes= do you want standart axis or make your own?
# frame.plot= frame arround plot yes/no
matpoints(mat, pch=rep(17,3), col=coll, ad=TRUE)
# to add points, pch controlls for type of points
axis(side=1, 1:4, labels=rownames(mat))
axis(side=2, 60:95, labels=60:95)
legend("topleft",# position
legend=c("maraqa", "aqua", "mar"),# names in legend,
lty=c(1,1,1),# type of filling in this case solide line,
col = coll,# colour of filling,
cex=0.7)# scaling parameter