没有情节以闪亮的方式显示 [英] No plot displayed with plotly in shiny

查看:69
本文介绍了没有情节以闪亮的方式显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从> https://plot.ly/r/粘贴代码时Shinyapp-plotly-events/到我的控制台中,没有显示出任何可绘制的图,我无法用plotly显示任何闪亮的图.

when I'm pasting the code from https://plot.ly/r/shinyapp-plotly-events/ into my console no plotly graph is diplayed, I can't get any plot in shiny displayed with plotly.

我的sessionInfo:

My sessionInfo:

R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plotly_4.7.0       ggplot2_2.2.1.9000 feather_0.3.1      RODBC_1.3-15       dplyr_0.5.0        shiny_1.0.3

我使用了错误的软件包版本吗?我重新安装了cran上的所有内容,但从未看到带有光泽的绘图. 我可以在Viewer的RStudio中生成绘图图.我必须使用plotly/ggplot/shiny的所有devtools版本还是所有devtool版本?我尝试了plotly_4.7.0.9000,但仍未显示任何输出.

Am I using the wrong package versions? I reinstalled everything from cran but i never see a plotly graph with shiny. I can produce the plotly graph's inside RStudio in the Viewer. Do I have to use any of the devtools versions of plotly/ggplot/shiny or all devtool versions? I tried plotly_4.7.0.9000 but still no output is shown.

我发现了 plotly图未显示的一句话,renderPlotly({ return(plot_ly(x))})已损坏,但是即使使用renderPlotly(data),我也无法产生任何闪亮的帧.

I found a post plotly graph doesn't show up that renderPlotly({return(plot_ly(x))}) is broken, but even with renderPlotly(data) I can't produce any frames in shiny.

plotly画廊中的示例代码,该错误应该在我的设置中,作为形式的代码,我想:

Example Code from the plotly gallery, the error should be in my setup I suppose, as a mater of form the code:

library(plotly)
library(shiny)

ui <- fluidPage(
  radioButtons("plotType", "Plot Type:", choices = c("ggplotly", "plotly")),
  plotlyOutput("plot"),
  verbatimTextOutput("hover"),
  verbatimTextOutput("click"),
  verbatimTextOutput("brush"),
  verbatimTextOutput("zoom")
)

server <- function(input, output, session) {

  output$plot <- renderPlotly({
    # use the key aesthetic/argument to help uniquely identify selected observations
    key <- row.names(mtcars)
    if (identical(input$plotType, "ggplotly")) {
      p <- ggplot(mtcars, aes(x = mpg, y = wt, colour = factor(vs), key = key)) + 
        geom_point()
      ggplotly(p) %>% layout(dragmode = "select")
    } else {
      plot_ly(mtcars, x = ~mpg, y = ~wt, key = ~key) %>%
        layout(dragmode = "select")
    }
  })

  output$hover <- renderPrint({
    d <- event_data("plotly_hover")
    if (is.null(d)) "Hover events appear here (unhover to clear)" else d
  })

  output$click <- renderPrint({
    d <- event_data("plotly_click")
    if (is.null(d)) "Click events appear here (double-click to clear)" else d
  })

  output$brush <- renderPrint({
    d <- event_data("plotly_selected")
    if (is.null(d)) "Click and drag events (i.e., select/lasso) appear here (double-click to clear)" else d
  })

  output$zoom <- renderPrint({
    d <- event_data("plotly_relayout")
    if (is.null(d)) "Relayout (i.e., zoom) events appear here" else d
  })

}

shinyApp(ui, server)

任何建议都非常欢迎,谢谢!

Any suggestions are very welcome, thanks!

推荐答案

问题已由 https修复. ://github.com/ropensci/plotly/issues/1042 在plotly的devtools版本中.

Issue was hotfixed by https://github.com/ropensci/plotly/issues/1042 in the devtools version of plotly.

devtools::install_github('ropensci/plotly')

这篇关于没有情节以闪亮的方式显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆