Я пытался использовать ploty в своем блестящем приложении, но оказалось, что тот же график работает локально, но не удалось запустить при развертывании в блестящем приложении, которое показывает только пустое. Этот сюжетный код работает локально,
plot_ly(caseonly,
x = ~ cases,
y = ~ county,
frame = ~ date,
type = "scatter",
mode = "markers"
) %>%
layout(showlegend = TRUE) %>%
animation_opts(frame = 100, redraw = FALSE)
Однако, когда я помещаю кодовый блок в блестящее приложение, он возвращается с пустой страницей? Любые советы?
Пример блестящего приложения.
header <- dashboardHeader()
sidebar <- dashboardSidebar(selectInput("County", "Please select:", c("King" = 0, "Queen" = 1)))
body <- dashboardBody(box(width = 14, plotlyOutput(outputId = "DI")))
# UI
ui <- dashboardPage(
skin = "blue",
header=header,
sidebar=sidebar,
body = body
)
# SERVER
server <- function(input, output) {
output$DI <- renderPlotly({
plot_ly(caseonly,
x = ~ cases,
y = ~ county,
frame = ~ date,
type = "scatter",
mode = "markers"
) %>%
layout(showlegend = TRUE) %>%
animation_opts(frame = 100, redraw = FALSE)
})
}
shinyApp(ui = ui, server = server)
А вот набор данных, который я использую:
> dput(head(caseonly,n=60))
structure(list(fips = c(1073L, 1073L, 1073L, 1073L, 1073L, 1073L,
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L,
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L,
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L,
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L,
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L,
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L
), county = c("Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County",
"Jefferson County"), state = c("AL", "AL", "AL", "AL", "AL",
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL",
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL",
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL",
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL",
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL"
), date = c("1/22/2020", "1/23/2020", "1/24/2020", "1/25/2020",
"1/26/2020", "1/27/2020", "1/28/2020", "1/29/2020", "1/30/2020",
"1/31/2020", "2/1/2020", "2/10/2020", "2/11/2020", "2/12/2020",
"2/13/2020", "2/14/2020", "2/15/2020", "2/16/2020", "2/17/2020",
"2/18/2020", "2/19/2020", "2/2/2020", "2/20/2020", "2/21/2020",
"2/22/2020", "2/23/2020", "2/24/2020", "2/25/2020", "2/26/2020",
"2/27/2020", "2/28/2020", "2/29/2020", "2/3/2020", "2/4/2020",
"2/5/2020", "2/6/2020", "2/7/2020", "2/8/2020", "2/9/2020", "3/1/2020",
"3/10/2020", "3/11/2020", "3/12/2020", "3/13/2020", "3/14/2020",
"3/15/2020", "3/16/2020", "3/17/2020", "3/18/2020", "3/19/2020",
"3/2/2020", "3/20/2020", "3/21/2020", "3/22/2020", "3/23/2020",
"3/24/2020", "3/25/2020", "3/26/2020", "3/27/2020", "3/28/2020"
), cases = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L,
5L, 12L, 17L, 21L, 25L, 34L, 0L, 50L, 61L, 71L, 86L, 91L, 129L,
169L, 179L, 214L), deaths = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L), BedLicensed = c(4473L, 4473L, 4473L, 4473L,
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L,
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L,
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L,
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L,
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L,
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L,
4473L, 4473L), TotPop = c(659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L,
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L
), rate = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
deathrate = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L)), row.names = c(NA, 60L), class = "data.frame")```