【发布时间】:2020-04-25 18:31:58
【问题描述】:
使用 view_follow() 时“尝试应用非函数”。删除 view_follow() 函数后,它按预期工作。我添加这个来调整轴上绘制的值的 y 轴基础。感谢您的帮助。
可重现的代码如下:
library(plyr)
library(dplyr)
library(ggplot2)
library(reshape)
library(reshape2)
library(gganimate)
samplelData <-
rbind(
cbind.data.frame(
year = as.integer(seq(from=2001,to=2020,by=1)),
Country = c('A'),
value = c(1:20)
),
cbind.data.frame(
year = as.integer(seq(from=2001,to=2020,by=1)),
Country = c('B'),
value = seq(from=10,to=400,by=20)
))
ggplot(samplelData,
aes(
x = Country,
y = value,
fill = Country,
frame = year
)) + geom_point(stat = 'identity', position = 'dodge') +
transition_reveal(year) + view_follow(fixed_x = TRUE) + labs(title = "Year: {round(frame_along, 0)}")
【问题讨论】: