Rmarkdown PDF中的绘图(ggplot2)已裁剪
在R中,我使用ggplot2绘图库创建绘图。我输出了一堆,并在它们之间打印Rmarkdown PDF中的绘图(ggplot2)已裁剪,r,ggplot2,R,Ggplot2,在R中,我使用ggplot2绘图库创建绘图。我输出了一堆,并在它们之间打印\n\n,这样它们就成为PDF中自己的段落(通过LaTeX)。最近(我认为是新的R版本),情节开始以这种方式被裁剪: 标题和图例并不完全可见,我不明白为什么会发生这种情况。我在Fedora31上使用R3.6.1和GGPLOT23.2.1。有没有办法让它们再次可读 这就是全部代码: --- title: "Cropping MWE" author: "Martin Ueding" date: \today output:
\n\n
,这样它们就成为PDF中自己的段落(通过LaTeX)。最近(我认为是新的R版本),情节开始以这种方式被裁剪:
标题和图例并不完全可见,我不明白为什么会发生这种情况。我在Fedora31上使用R3.6.1和GGPLOT23.2.1。有没有办法让它们再次可读
这就是全部代码:
---
title: "Cropping MWE"
author: "Martin Ueding"
date: \today
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
```
We can try it with ggplot2:
```{r}
ggplot(diamonds, aes(x = x, y = y, color = color)) +
geom_point() +
labs(title = 'Shape and color of diamonds')
```
And then we can also try it using the built-in plotting.
```{r}
with(diamonds, plot(x, y, main = 'Shape and color of diamonds'))
```
And some more text afterwards.
我可以更改标题以防止裁剪,然后它就可以工作了
---
title: "Cropping MWE"
author: "Martin Ueding"
date: \today
output:
pdf_document:
fig_crop: false
---
然而,这些图形周围有一些零散的空间,这也不是完美的。请同时显示您的rmarkdown区块选项。@Gregor:当然。我添加了一个简单的示例,这样可以更容易地诊断这个问题。请同时显示您的rmarkdown块选项。@Gregor:当然。我添加了一个最简单的示例,这样可以更容易地诊断这个问题。