I'm trying to get my plot to appear immediately underneath my code. I've seen two other questions like this.
Figure position in markdown when converting to PDF with knitr and pandoc
These each have many suggestions, some of them very complicated, but none have worked. The suggested answer from Yihui: https://yihui.name/knitr/options/ is
fig.show: ('asis'; character) how to show/arrange the plots; four possible values are asis: show plots exactly in places where they were generated (as if the code were run in an R terminal);
but that also doesn't work. This is my current attempt. If you knit it as an html, the figures show up in the right places but lose their captions. Is there something extra that I need to install? Or additional code?
---
title: "Plotting Plots Under Code"
author: "Ilana"
date: "February 1, 2017"
output: pdf_document
fig.show: "asis"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
```
## Title
```{r fig.cap="Sample Plots"}
plot(iris$Sepal.Length,iris$Petal.Length,main="First One")
plot(iris$Sepal.Length,iris$Petal.Length,main="Second One")
#Where I want figure two
plot(iris$Sepal.Length,iris$Petal.Length,main="Third One")
```
More Text, Which should be on the bottom of the document
Thank you