Why does the plot print outside the HTML div?

The excerpt is from a Rhtml file. The plot prints outside the floating div. How can I make the plot print inside the floating div?

ii.[["plot."]] contains a ggplot.

<!--begin.rcode fig.show = 'asis', results = 'asis' 
for(i. in l.)
{

  for(ii. in i.[["diagnosisHistogram."]]) 
  {
    cat("<div style = 'float:left'>")
    
    plot(ii.[["plot."]])
    
    cat("</div>")
  }
  
  #cat("<p style='page-break-after: always;'></p>")
}
end.rcode-->