【发布时间】:2015-12-21 06:47:53
【问题描述】:
我研究并发现了如何在 rmarkdown 文档中创建水印。
它在基本文本上效果很好,但是当你有一个情节沉重的页面时,它会隐藏在情节后面。
显然,这使某人可以轻松截屏并在 PDF 之外使用它们。
下面是一些清楚地说明问题的代码。
---
title: "Testing Watermark"
author: "John"
date: "September 18, 2015"
header-includes:
- \usepackage{draftwatermark}
output:
pdf_document
---
This is some basic text.
Note the watermark on this page, and the hidden watermark on the next page.
\newpage
\SetWatermarkText{DRAFT}
```{r echo=FALSE, warning=FALSE, message=FALSE, fig.height=7}
library(ggplot2)
ggplot(mtcars) +
geom_point(aes(mtcars$mpg, mtcars$cyl)) +
facet_wrap(~carb, ncol=1) +
theme_bw()
```
如果有人知道解决此问题的方法,我将不胜感激。
就我而言,要么使 ggplot 背景透明(我尝试过),要么将水印带到前景并使其透明。
【问题讨论】:
-
查看cowplot包。
-
如果您需要标记为您自己的东西,您可以将版权文本添加到违规情节本身,这样可以保护您免受屏幕限制。
-
我在cowplot中看到了注释,但真的想避免每个图表都带有注释。我想我可以将它分配给一个变量,但我真的很想在文档中有一个地方可以打开/关闭水印。
标签: r latex knitr r-markdown watermark