plotly / plotly/plotly.R

ggplotly crashes when AGG is required as graphical engine

Aperta
#2,286 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
R
Stelle
2.7k
Fork
641
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I'm developing Shiny apps in a platform, where the graphical engine in RStudio (browser version) needs to be AGG.
When making interactive plots with ggplotly the app crashes when running from RStudio with the following error message:

Listening on http://127.0.0.1:7615
Warning: Error in dev_fun: X11 is not available
  106: dev_fun
  105: gg2list
  104: ggplotly.ggplot
  103: ggplotly
  102: %>%
  101: renderPlotly [/PATH_TO_APP/app.R#77]
  100: func
   97: shinyRenderWidget
   96: func
   83: renderFunc
   82: output$distggPlotly
    1: runApp

The static plots in the app are working fine, but the plotly variant causes the problem (see below).

app.R file

library(shiny)
library(tidyverse)
library(plotly)

ui <- fluidPage(

    titlePanel("Old Faithful Geyser Data"),

    sidebarLayout(
        sidebarPanel(
            sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30)
        ),

        mainPanel(
           plotOutput("distPlot"),
           plotOutput("distggPlot"),
           plotlyOutput("distggPlotly")
        )
    )
)

server <- function(input, output) {
  output$distPlot <- renderPlot({
      x    <- faithful[, 2]
      bins <- seq(min(x), max(x), length.out = input$bins + 1)

      hist(x, breaks = bins, col = 'darkgray', border = 'white',
           xlab = 'Waiting time to next eruption (in mins)',
           main = 'Histogram of waiting times')
  })
    
  output$distggPlot <- renderPlot({
    x    <- faithful[, 2]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    
    faithful %>% ggplot(aes(x = waiting)) +
      geom_histogram(breaks = bins, fill = 'darkgray', colour = 'white') + 
      labs(x = 'Waiting time to next eruption (in mins)',
           title = 'Histogram of waiting times')
  })
    
  output$distggPlotly <- renderPlotly({
    x    <- faithful[, 2]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    
    gg_hist <- faithful %>% ggplot(aes(x = waiting)) +
      geom_histogram(breaks = bins, fill = 'darkgray', colour = 'white') + 
      labs(x = 'Waiting time to next eruption (in mins)',
           title = 'Histogram of waiting times')
    gg_hist %>% ggplotly()
  })
    
}

shinyApp(ui = ui, server = server)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Iniziate riproducendo il problema dall’esempio app.R fornito con il motore grafico AGG di RStudio e la chiamata ggplotly(). Tracciate l’errore X11 segnalato tramite gg2list e verificate che l’applicazione Shiny possa eseguire il rendering del grafico interattivo senza richiedere X11.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
r
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.