Plotly: Error when using 'config' options with latest plotly R package

Created on 3 Oct 2016  Â·  7Comments  Â·  Source: ropensci/plotly

I have been using the 'config' option and as below forever at the end of my plotly plot code, and suddenly it stops working from RStudio console (simply returns textual object to console) and simply fails with an error in Shiny.

Code:

plot_ly(mtcars, x = ~wt, y = ~mpg, type = 'scatter', mode = 'markers') %>% 
  config(displayModeBar = 'hover', showLink = FALSE, displaylogo = FALSE)

Console output (instead of a plot in the 'viewer') in RStudio console:

<request>
Options:
* : list(x = list(visdat = list(`11c46bc2822` = function () 
plotlyVisDat), cur_data = "11c46bc2822", attrs = list(`11c46bc2822` = list(x = ~wt, y = ~mpg, mode = "markers", alpha = 1, sizes = c(10, 100), type = "scatter")), layout = list(width = NULL, height = NULL, margin = list(b = 40, l = 60, t = 25, r = 10)), config = list(modeBarButtonsToRemove = "sendDataToCloud"), base_url = "https://plot.ly", source = "A"), width = NULL, height = NULL, sizingPolicy = list(defaultWidth = "100%", defaultHeight = 400, padding = NULL, viewer = list(defaultWidth = NULL, 
    defaultHeight = NULL, padding = NULL, fill = TRUE, suppress = FALSE, paneHeight = NULL), browser = list(defaultWidth = NULL, defaultHeight = NULL, padding = NULL, fill = TRUE), knitr = list(defaultWidth = NULL, defaultHeight = NULL, figure = TRUE)), dependencies = NULL, elementId = NULL, preRenderHook = function (p) 
{
    UseMethod("plotly_build")
}, jsHooks = list())
* displayModeBar: hover
* showLink: FALSE
* displaylogo: FALSE

Shiny app and error when opening the plot:

ui <- fluidPage(
  fluidRow(
    mainPanel(
      plotlyOutput('plot'),
      width = 12
    )
  )
)

server <- function(input, output) {
  output$plot <- renderPlotly({
    plot_ly(mtcars, x = ~wt, y = ~mpg, type = 'scatter', mode = 'markers') %>%
    config(displayModeBar = 'hover', showLink = FALSE, displaylogo = FALSE)
  })
}

shinyApp(ui = ui, server = server)

Error message:

Listening on http://127.0.0.1:7691
Warning: Error in UseMethod: no applicable method for 'ggplotly' applied to an object of class "request"
Stack trace (innermost first):
    82: ggplotly
    81: func
    80: origRenderFunc
    79: output$plot
     4: <Anonymous>
     3: do.call
     2: print.shiny.appobj
     1: <Promise>
packageVersion('plotly')
[1] ‘4.5.2’
packageVersion('shiny')
[1] ‘0.14’

version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          3.1                         
year           2016                        
month          06                          
day            21                          
svn rev        70800                       
language       R                           
version.string R version 3.3.1 (2016-06-21)
nickname       Bug in Your Hair  

Any idea what is going on?

Most helpful comment

Warning: Error in UseMethod: no applicable method for 'ggplotly' applied to an object of class "request"

This issue this likely fixed by changing config() to plotly::config() ^^^

All 7 comments

fa93fd1 should fix it

I am getting this error with plotly 4.6.0. The examples provied by gtumuluri fail for me.

I also get the same error message as gtumuliri
Warning: Error in UseMethod: no applicable method for 'ggplotly' applied to an object of class "request"
when using the 'config' option with plotly version 4.7.0 and shiny version 1.0.3.

Same problem. Plotly 4.7.0. Shiny 1.0.3.

Same problem, plotly 4.7.1, shiny 1.1.0

Warning: Error in UseMethod: no applicable method for 'ggplotly' applied to an object of class "request"

This issue this likely fixed by changing config() to plotly::config() ^^^

Warning: Error in UseMethod: no applicable method for 'ggplotly' applied to an object of class "request"

This issue this likely fixed by changing config() to plotly::config() ^^^

You saved me, thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pssguy picture pssguy  Â·  7Comments

komalsrathi picture komalsrathi  Â·  6Comments

kranthikandi picture kranthikandi  Â·  4Comments

escorial82 picture escorial82  Â·  6Comments

johncarew picture johncarew  Â·  6Comments