title: Print a list of dynamically-sized plots in knitr
body: <p>I want to be able to print out non-predetermined list of plots in knitr. I <em>am</em> able to do that, but there are a few wrinkles left to iron out. Namely:</p>
  
  <p>1) How do you suppress the list indices (like [[2]]) on each page that precede each plot? Using echo=FALSE doesn't do anything. </p>
  
  <p>2) Is it possible to set the size for <em>each plot</em> as they are rendered? I've tried setting a size variable outside of the chunk, but that only lets me use one value and not a different value per plot. </p>
  
  <p>I'm asking this as one question because they seem to speak to the same lesson, i.e., producing a list of plots. </p>
  
  <p>Some sample code:</p>
  
  <pre><code>\documentclass{article}
  \usepackage[margin=.5in, landscape]{geometry}
  \begin{document}
  
  &lt;&lt;diamond_plots, echo = FALSE, results = 'hide'&gt;&gt;==
  library(ggplot2)
  
  diamond_plot = function(data, cut_type){
    ggplot(data, aes(color, fill=cut)) + 
      geom_bar() +
      ggtitle(paste("Cut:", cut_type, sep = ""))
  }
  
  cuts = unique(diamonds$cut)
  plots = list()
  for(i in 1:length(cuts)){
      data = subset(diamonds, cut == cuts[i])
      plots[[i]] = diamond_plot(data, cuts[i])
  }
  height = 3
  @
  
  &lt;&lt;print_plots, results='asis', echo=FALSE,  fig.width=10, fig.height=height&gt;&gt;=
  plots
  @
  \end{document}
  </code></pre>
  
  <p>The PDF of the plots looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/rhams.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rhams.png" alt="enter image description here"></a></p>