id <- c(1:9)
test1 <- c(25,24,27,21,50,71,54,62,30)
test2 <- c(54,42,64,33,53,61,55,35,46)
test3 <- c(35,34,17,61,20,41,50,69,80)
test4 <- c(44,92,64,53,33,91,25,65,86)
level <- c(1,2,3,1,2,3,1,2,3)
Data <- data.frame(id,test1,test2,test3,test4,level)
library(RColorBrewer)
cols <- brewer.pal(n=3,name="Set1")
cols_L <- cols[level]
par(mar = c(4, 4, 0.3, 1))
layout(mat = matrix(c(1, 2, 3, 3, 4, 5), ncol = 2, byrow = TRUE), height = c(1, 0.5, 1))
plot(test1,col=cols_L,pch=16)
plot(test2,col=cols_L,pch=16)
plot(1, axes = FALSE, xlab = '', ylab = '', type = 'n')
legend("center",c("1","2","3"), col=cols,pch=c(16),bty="n",ncol=3)
plot(test3,col=cols_L,pch=16)
plot(test4,col=cols_L,pch=16)