title: Too many open devices r
body: <p>I'm trying to write many graphs to one olocation, but instead its writing a bunch of blank pictures:</p>
  
  <p>my code looks like:</p>
  
  <pre><code>titleplot&lt;-NULL
  for(i in 1:99){
    titleplot&lt;-colnames(data[i])
    mypath &lt;- file.path("C:","Users","user.ME","Desktop","graph outputs", paste("myplot_", titleplot, ".jpg", sep = ""))
    plot(data[,i],type="l", main =titleplot)
    jpeg(file=mypath)
    dev.off()
  }
  </code></pre>
  
  <p>Does anyone know why this would happen or how I can remedy this?</p>