如何在Quarto文档中旋转一个图形(.png)

huangapple go评论72阅读模式
英文:

How to rotate a figure (.png) in a Quarto document

问题

我在我的 Quarto 文档中包括了一个图像(.png)。

由于这个图像太大且信息丰富,我想将它旋转为横向格式以提高可读性。

我只找到适用于 revealjs 的解决方案,而这些解决方案在文章格式下不起作用(参见例如此帖子:https://stackoverflow.com/questions/76069903/rotate-images-in-quarto)。

有什么建议吗?

英文:

I included a figure (.png) in my Quarto Document.

As the figure is so big and rich in information I want to rotate it to a landscape format for improving readability.

I only find solutions for revealjs that do not work with an article format (see e.g., this thread: https://stackoverflow.com/questions/76069903/rotate-images-in-quarto)

Any suggestions?

答案1

得分: 1

"Does this help (see here for more alternatives)?


title: "Test Landscape"
format:
pdf:
number-sections: true
include-in-header:
- text: |
\usepackage{lscape}
\newcommand{\blandscape}{\begin{landscape}}
\newcommand{\elandscape}{\end{landscape}}

normal

hist(mtcars$mpg)

\blandscape

Landscape {#sec-landscape}

#| fig-cap: A Caption
#| label: fig-hist
hist(mtcars$mpg)

\elandscape

Let's try out crossreference.

We can see in section @sec-landscape that the histogram @fig-hist is turned around.

如何在Quarto文档中旋转一个图形(.png)

英文:

Does this help (see here for more alternatives)?

---
title: "Test Landscape"
format: 
  pdf:
    number-sections: true
    include-in-header:
          - text: |
             \usepackage{lscape}
             \newcommand{\blandscape}{\begin{landscape}}
             \newcommand{\elandscape}{\end{landscape}}
---


# normal
```{r}
hist(mtcars$mpg)
```


\blandscape
# Landscape {#sec-landscape}
```{r}
#| fig-cap: A Caption
#| label: fig-hist
hist(mtcars$mpg)
```
\elandscape

Let's try out crossreference.

We can see in section @sec-landscape that the histogram @fig-hist is turned around.

如何在Quarto文档中旋转一个图形(.png)

huangapple
  • 本文由 发表于 2023年7月18日 15:28:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76710419.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定