0

I am using this code to plot my graphs but I do not know how can I add legends?

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')
Arun
  • 116,683
  • 26
  • 284
  • 387
user2312186
  • 453
  • 1
  • 4
  • 8

1 Answers1

1

Have you tried the regular way of adding a legend in R?

legend("bottom", c("px", "y"), col=c("blue", "red"), lty = c(1), cex = 0.7)
david
  • 580
  • 4
  • 12