这里有一个基础的解决方案:
df <- read.table(text="Samples Sample1 Sample2 Sample3 Sample4 Sample5
Species1 12 25 25 25 25
Species2 12 23 23 23 23
Species3 12 21 21 21 21
Species4 12 19 19 19 19
Species5 12 17 17 17 17
Species6 1 15 15 15 15
Species7 5 13 13 13 13", header=T)
df <- reshape2::melt(df)
par(mar=c(4.1,6.1,2.1,4.1), xpd=T)
plot(y=as.integer(df$Samples), x=as.integer(df$variable), pch=20, cex=df$value/10, bty="n", axes = F, xlab="", ylab="")
axis(2, at = unique(as.integer(df$Samples)), labels = levels(df$Samples), line = 0.5, las=2)
axis(1, at = unique(as.integer(df$variable)), labels = levels(df$variable), line = 0.5)
legend(y=max(as.integer(df$Samples)/1.5), x=max(as.integer(df$variable))+0.25, legend = c(1,5,10,15,20,25), pch = 20, bty="n", pt.cex=c(1,5,10,15,20,25)/10)
你能更好地解释预期的输出? – Al14