I want to plot a number of graph using this for loop. however, I can only get one output (foo0001).
for (i in 1:5) {
bitmap("foo%03d.jpg")
plot(runif(20), ylim = c(0, 1))
dev.off()
}
please help!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
bitmapwrites each page (plot) to consecutive files according to the format string chosen. Callingbitmapcreates a new graphics device, resetting the page number. So, by plotting one plot perbitmapcall, you are always writing tofoo0001.jpg.Instead, call
bitmapjust once: