Rmarkdown:旋转图像/图形及其标题

时间:2020-06-07 12:09:35

标签: r latex r-markdown knitr

我正在尝试将绘图及其Rmarkdown中的标题旋转90度。

最小的可复制示例代码是:

---
title: "Checking"
author: "Tester"
date: "6/7/2020"
header-includes:
   - \usepackage{rotating}
output: 
  pdf_document:
    fig_caption: yes
    number_sections: true
---
{
\hypersetup{linkcolor=black}
\tableofcontents 
\listoffigures
\listoftables
}
\newpage

```{r  rmplots 0.125 high, fig.align="center", fig.scap="Check", out.extra='angle=90',echo=FALSE, fig.cap="Check"}
plot(1)        
abline(0, 1)    
```

使用out.extra='angle=90'旋转图本身可以很好地工作,但是旋转标题会给我带来麻烦。

我尝试使用@ Jub0bs的建议(https://tex.stackexchange.com/a/101650),对我来说,该建议如下:

\begin{sidewaysfigure}
    \centering

        \includegraphics{CorrelatedRM125High.png}

    \caption{Box plot of number of positions sent per iteration using this scheme}
    \label{fig:awesome_image}
\end{sidewaysfigure}

但是它返回以下错误:

!软件包pdftex.def错误:找不到文件`CorrelatedRM125High.png': 使用草稿设置。

我尝试了@Danie Els的方法(https://tex.stackexchange.com/a/46337),该方法是将图形和标题保存在一个框中,然后旋转该框,但是会导致相同的错误。

我找不到足够的信息来解决此问题。

对我来说,旋转的对象是绘图还是图像都没关系-两种方法都可以。

我希望也许有人也有类似的经历,并且可以指导我如何进行。

我想知道是否有解决方案:i)在Rmarkdown(@CL。的评论(这里:Knitr: Turning the R chunk figure caption 90 degrees inline Latex)中,建议knitr不提供此选项,但该评论已经来自某些人。时间之前-也许现在有修复程序?),或ii)关于如何合并Latex代码的建议,但同时避免上面的错误消息。

提前谢谢!


编辑: 如建议的评论所示,我使用sidewaysfigure提供了一个最小的可重现示例。

拍摄示例图像不会导致任何错误:

\begin{sidewaysfigure}
    \centering
        \includegraphics{example-image-a}
    \caption{Box plot of number of positions sent per iteration using this scheme}
    \label{fig:awesome_image}
\end{sidewaysfigure}

在与我的实际图像相同的目录中使用另一个.jpeg格式的我的图像也不会返回任何错误。


我有一个问题,如果使用.png为什么会导致错误。


另一个编辑:

如@samcarter所建议的,即使用示例example-image.png,它也不会返回错误!

\newpage

\begin{sidewaysfigure}
    \centering
        \includegraphics{example-image.png}
    \caption{Box plot of number of positions sent per iteration using this scheme}
    \label{fig:awesome_image}
\end{sidewaysfigure}

运行:

\begin{sidewaysfigure}
    \centering
        \includegraphics{CorrelatedRM125High.PNG}
    \caption{Box plot of number of positions sent per iteration using this scheme}
    \label{fig:awesome_image}
\end{sidewaysfigure}

再次导致相同的错误:

!软件包pdftex.def错误:找不到文件`CorrelatedRM125High.PNG': 使用草稿设置。

0 个答案:

没有答案
相关问题