[R] Creating pdfs using qplot in qqplot2

Bos, Roger roger.bos at rothschild.com
Tue Mar 23 19:14:45 CET 2010


I am trying to create plots within a for loop and output them to a pdf.
Here is a working example using plot:

          gg <- data.frame(datadate=1:4, spread=5:8)
          pdf()
          for (i in 1:3) {
              plot(gg$datadate, gg$spread, main=i)
          }
          dev.off()

I am trying to learn more about ggplot2 so I try a slight modification
and it doesn't work.  Anyone know how to do this using qplot in ggplot2?


     	   gg <- data.frame(datadate=1:4, spread=5:8)
          pdf()
          for (i in 1:3) {
              qplot(gg$datadate, gg$spread, geom="line", main=i)
          }
          dev.off()

***************************************************************

This message is for the named person's use only. It may\...{{dropped:20}}



More information about the R-help mailing list