Created
May 1, 2011 19:33
-
-
Save tony91782/950784 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ------------------------- ## | |
## An Example of ## | |
## Automating Plot Output ## | |
## ------------------------- ## | |
names = LETTERS[1:26] ## Gives a sequence of the letters of the alphabet | |
beta1 = rnorm(26, 5, 2) ## A vector of slopes (one for each letter) | |
beta0 = 10 ## A common intercept | |
for(i in 1:26){ | |
x = rnorm(500, 105, 10) | |
y = beta0 + beta1[i]*x + 15*rnorm(500) | |
mypath <- file.path("C:","R","SAVEHERE",paste("myplot_", names[i], ".jpg", sep = "")) | |
jpg(file=mypath) | |
mytitle = paste("my title is", names[i]) | |
plot(x,y, main = mytitle) | |
dev.off() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment