我有一个动画情节,通过一个R(不是闪亮的应用程序)脚本正确显示:
load("HF.RData") # this contains the dataframe dt1.HF
p <- ggplot(dt1.HF, aes(x = tm, y = HF, colour = team)) +
geom_point(aes(frame = sn, ids = tm), size = 5)
p <- ggplotly(p)
animation_opts(p, frame = 1000, transition = 500, easing = "linear",
redraw = TRUE, mode = "immediate")
但是,我无法在一个闪亮的应用程序中显示它,在本地运行(而不是在一个闪亮的服务器上),使用相同的数据帧。目前,我的(简化)闪亮应用程序是:
library(shiny)
library(ggplot2)
library(plotly)
shinyApp(
shinyUI(
fluidPage(
plotOutput("HF.plot")
)
),
shinyServer(function(input, output, session) {
load("HF.RData")
output$HF.plot <- renderPlotly({
p <- ggplot(dt1.HF, aes(x = tm, y = HF, colour = team)) +
geom_point(aes(frame = sn, ids = tm), size = 5)
p <- ggplotly(p)
animation_opts(p, frame = 1000, transition = 500, easing = "linear",
redraw = TRUE, mode = "immediate")
})
})
)
我有什么遗漏或做错了吗?