transition_time 只有一个几何体/图层有阴影标记
transition_time with shadow mark for only one geom / layer
我相信下面的图片应该是不言自明的。使用 transition_time
时,有没有人知道如何为一个几何体(用于标记)创建阴影标记?
非常欢迎任何解决方法。在正常世界中,我会创建两个图(图和标题),但我不知道如何在这样的组合图上使用 gganimate,至少我没有找到 cowplot 和 patchwork 的解决方案(给定至少 patchwork 共享同一个开发人员,我认为它可能会起作用。)
library(ggplot2)
library(gganimate)
myfoo <- data.frame(time = 1:100, x = 1:100, y = 1)
p <-
ggplot(myfoo) +
geom_point(aes(x, y)) +
geom_text(aes(x = 0, y = 0, label = time))
p_anim <-
p +
transition_time(time) +
shadow_mark()
animate(p_anim, height = 150, width = 250)
左下角的标签不应该有阴影标记。
我正在寻找的是如下内容:
p_title <-
ggplot(myfoo) +
geom_point(aes(x, y)) +
labs(title = "{frame_time}")
p_title_anim <-
p_title +
transition_time(time) +
shadow_mark()
animate(p_title_anim, height = 150, width = 250)
标题中的交互元素应该是情节注释。
正如 Z.Lin 在她的评论中所建议的,这里是 shadow_mark()
中带有 exclude_layer
参数的解决方案:
我会接受这个,以免再将其标记为未答复。我还是希望Z.Lin能post她的评论作为回答..
library(ggplot2)
library(gganimate)
myfoo <- data.frame(time = 1:100, x = 1:100, y = 1)
p <-
ggplot(myfoo) +
geom_point(aes(x, y)) +
geom_text(aes(x = 0, y = 0, label = time))
p_anim <-
p +
transition_time(time) +
shadow_mark(exclude_layer = 2)
animate(p_anim, height = 150, width = 250)
由 reprex package (v0.3.0)
于 2020-10-03 创建
我相信下面的图片应该是不言自明的。使用 transition_time
时,有没有人知道如何为一个几何体(用于标记)创建阴影标记?
非常欢迎任何解决方法。在正常世界中,我会创建两个图(图和标题),但我不知道如何在这样的组合图上使用 gganimate,至少我没有找到 cowplot 和 patchwork 的解决方案(给定至少 patchwork 共享同一个开发人员,我认为它可能会起作用。)
library(ggplot2)
library(gganimate)
myfoo <- data.frame(time = 1:100, x = 1:100, y = 1)
p <-
ggplot(myfoo) +
geom_point(aes(x, y)) +
geom_text(aes(x = 0, y = 0, label = time))
p_anim <-
p +
transition_time(time) +
shadow_mark()
animate(p_anim, height = 150, width = 250)
我正在寻找的是如下内容:
p_title <-
ggplot(myfoo) +
geom_point(aes(x, y)) +
labs(title = "{frame_time}")
p_title_anim <-
p_title +
transition_time(time) +
shadow_mark()
animate(p_title_anim, height = 150, width = 250)
正如 Z.Lin 在她的评论中所建议的,这里是 shadow_mark()
中带有 exclude_layer
参数的解决方案:
我会接受这个,以免再将其标记为未答复。我还是希望Z.Lin能post她的评论作为回答..
library(ggplot2)
library(gganimate)
myfoo <- data.frame(time = 1:100, x = 1:100, y = 1)
p <-
ggplot(myfoo) +
geom_point(aes(x, y)) +
geom_text(aes(x = 0, y = 0, label = time))
p_anim <-
p +
transition_time(time) +
shadow_mark(exclude_layer = 2)
animate(p_anim, height = 150, width = 250)
由 reprex package (v0.3.0)
于 2020-10-03 创建