title: save multiple plots in R as a .jpg file, how?
body: <p>I am very new to R and I am using it for my probability class. I searched for this question here, but it looks that is not the same as I want to do. (If there is already an answer, please tell me).</p>
  
  <p>The problem is that I want to save multiple plots of histograms in the same file. For example, if I do this in the R prompt, I get what I want:</p>
  
  <pre><code>library(PASWR)
  data(Grades)
  attach(Grades) # Grade has gpa and sat variables
  par(mfrow=c(2,1))
  hist(gpa)
  hist(sat)
  </code></pre>
  
  <p>So I get both histograms in the same plot. but if I want to save it as a jpeg:</p>
  
  <pre><code>library(PASWR)
  data(Grades)
  attach(Grades) # Grades has gpa and sat variables
  
  par(mfrow=c(2,1))
  jpeg("hist_gpa_sat.jpg")
  hist(gpa)
  hist(sat)
  dev.off()
  </code></pre>
  
  <p>It saves the file but just with one plot... Why? How I can fix this?
  Thanks.</p>
  
  <p>Also, if there is some good article or tutorial about how to plot with gplot and related stuff it will be appreciated, thanks.</p>