在R中,我使用ggplot2绘图库创建绘图。我输出了一堆,并在它们之间打印\n\n
,以使它们成为PDF中的独立段落(通过LaTeX)。最近(我认为是新的R版本),地块开始以这种方式被裁剪:
标题和图例不完全可见,我不明白为什么会这样。我在Fedora 31上将R 3.6.1与ggplot2 3.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
---
但是,这些人物周围有一些杂散空间,这也不是完美的。