Well you can use the main argument of the plot function together with a call to sprintf(). Like this:

main = sprintf("Plot %s", i)

Best regards

Frede


Sendt fra Samsung mobil


-------- Oprindelig meddelelse --------
Fra: li li
Dato:24/06/2014 15.19 (GMT+01:00)
Til: r-help
Emne: [R] Making several plots using a loop function

Hi all,
   When making a bunch of plots using a loop function, how to add title to
reflect different plots.
Specifically, for the code below, I generated 9 plots.  I would like to add
a title to each plot.
For example, the titles will be respectively, plot1, plot 2, … plot 9.
Thank you very much!
    Hanna



par(mfrow=c(3,3), pty="s", pch=16, col="blue")
for ( i in 1:9) {
lm1 <-  lm(log(run_res[2:11, i]) ~ log(level))
plot(log(level), log(run_res[2:11, i]), xlab="dllution levels",
ylab="%PS-80")
abline(lm1)}

        [[alternative HTML version deleted]]


	[[alternative HTML version deleted]]

