使用 xaringan 和 R markdown 创建演示文稿时是否可以调整背景图像的不透明度?例如,这是 Ninja 模板,其中仅包含 Karl 的幻灯片作为背景。我需要做什么来改变这个背景的不透明度?
\n编辑:为了澄清,我希望能够根据具体情况调整背景不透明度,而不是针对幻灯片中的每个背景图像。
\n---\ntitle: "Presentation Ninja"\nsubtitle: "\xe2\x9a\x94<br/>with xaringan"\nauthor: "Yihui Xie"\ninstitute: "RStudio, PBC"\ndate: "2016/12/12 (updated: `r Sys.Date()`)"\noutput:\n xaringan::moon_reader:\n lib_dir: libs\n nature:\n highlightStyle: github\n highlightLines: true\n countIncrementalSlides: false\n---\n\n\nbackground-image: url(`r xaringan:::karl`)\nbackground-position: 50% 50%\nclass: right, top\n\n# You only live once!\nRun Code Online (Sandbox Code Playgroud)\n 我有县级数据记录了 2002 年至 2018 年在该县首次检测到入侵性害虫的年份。我使用 ggplot2 和地图包创建了一张地图,该地图包根据检测到害虫的年份用颜色填充县多边形。 
**有没有办法使用 gganimate 包来制作这张地图的动画,第一帧只填充检测日期为 2002 年的多边形,第二帧填充检测日期为 2003 年或更早(所以 2002 和 2003)的多边形,检测日期为 2004 年或更早(2002、2003、2004)等的第三个框架?** 澄清:我希望所有县多边形始终可见并最初填充为白色,动画的每一帧都根据检测年份添加县填充。
我试过使用 transition_reveal(data$detect_year)与静态图一起但得到一个错误,即“沿数据必须是整数、数字、POSIXct、日期、difftime 或 orhms”。
这是可重现示例的一些代码:
library(dplyr)
library(purrr)
library(maps)
library(ggplot2)
library(gganimate)
# Reproducible example
set.seed(42)
map_df <- map_data("county") %>%
filter(region == "minnesota")
map_df$detection_year <- NA
# Add random detection year to each county
years <- 2002:2006
map_list <- split(map_df, f = map_df$subregion)
map_list <- map(map_list, function(.x) {
.x$detection_years <- mutate(.x, detection_years = sample(years, 1))
})
# collapse list back to …Run Code Online (Sandbox Code Playgroud)