I am trying to plot some data from my swim team from the last competitions.
动画图在这里: https://imgur.com/aoNs1HC
(1) 为了改善外观,我插入了背景图像。但是,此背景图像以某种方式覆盖了原始动画。您可以在下面的动画中看到它。该背景图像已经具有70%的不透明度,但是我仍然看不到动画线。
我尝试更改背景图片的不透明度,但没有成功
library(ggplot2)
library(gganimate)
library(png)
data <- tibble::tribble(~Heat, ~Performance,
8.1, 5.6,
8.2, 5.9,
8.3, 5.5,
8.4, 6.2,
8.5, 6.8,
8.6, 7.2,
8.7, 7.6,
)
url <- "https://i.imgur.com/mREnnlF.png"
download.file(url, destfile = "background_image.png")
background_image <-readPNG("background_image.png")
p <- ggplot(data, aes(Heat, Performance)) +
geom_line(color='coral', size = 1) +
geom_point(color= "steelblue", size = 3) +
background_image(background_image) +
transition_reveal(Heat) +
ease_aes('cubic-in-out')
animate(p, fps = 10, end_pause=10, width = 800, height = 400)
我希望使动画线清晰地显示在正面,而背景图像设置为100%不透明,因此与前景中的动画线明显不同。