图之前,而不是 #Discussion 之后 - R Markdown

figure before, not after #Discussion - R Markdown

我在定位图形时遇到问题。

我的header:

\usepackage{amsmath}
\usepackage{pdflscape}
\newcommand{\blandscape}{\begin{landscape}}
\newcommand{\elandscape}{\end{landscape}}

我的一些 R Markdown 代码:

\newpage
\blandscape
```{r finaltable1_1, echo=FALSE}
table1_1
```
\elandscape

\newpage
\blandscape
```{r figone, message=FALSE, warning=FALSE, echo=FALSE, out.width='100%', fig.align='center', fig.cap='description.'}
knitr::include_graphics('./images/figure2.pdf')
```
\elandscape

\newpage
```{r figresults, message=FALSE, warning=FALSE, echo=FALSE, out.width='100%', fig.align='center', fig.cap='description.'}
knitr::include_graphics('./images/figure3.pdf')
```

\newpage
# Discussion

图 3 应该放在讨论之前,但它显示在讨论之后,关于可能发生的事情有什么想法吗?

所以,您可以通过以下方式解决您的问题:

a) 减小此块中图片的宽度:

```{r figresults, message=FALSE, warning=FALSE, echo=FALSE, out.width='70%', fig.align='center', fig.cap='description.'}
knitr::include_graphics('pic.pdf')
```

b) 使用另一种结构:

![My piccy-pic](pic.pdf){width=90%}

\begin{figure}[H]
\centering
\includegraphics[width=0.9\textwidth]{pic.pdf}
\caption{I'm here}
\end{figure}