0

我正在使用此代码绘制图表,但我不知道如何添加图例?

library(gplots)
data1 <- as.matrix(read.table('$INPUT_FILE1', header = T))
data2 <- as.matrix(read.table('$INPUT_FILE2', header = T))
data1.experiment <- as.factor(data1[,\"$FACTORS\"])
data1.obs <- as.numeric(data1[,\"$RESPONSE_VAR\"])
data2.obs <- as.numeric(data2[,\"$RESPONSE_VAR\"])
pdf(file = 'MeanPlot.pdf', width=5, height=5)
plotmeans(data2.obs ~ data1.experiment, xlab='$FACTORS', ylab='$RESPONSE_VAR')
plotmeans(data1.obs ~ data1.experiment, xlab='$FACTORS', ylab='$RESPONSE_VAR')
4

1 回答 1

1

您是否尝试过在 R 中添加图例的常规方法?

legend("bottom", c("px", "y"), col=c("blue", "red"), lty = c(1), cex = 0.7)
于 2013-04-24T20:11:25.110 回答