plotly / plotly/plotly.R

ggplotly crashes when AGG is required as graphical engine

Abierto
#2,286 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
R
Estrellas
2.7k
Forks
641
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comience reproduciendo el fallo del ejemplo app.R proporcionado con el motor gráfico AGG de RStudio y la llamada ggplotly(). Rastree el error de X11 informado a través de gg2list y verifique que la aplicación Shiny pueda renderizar el gráfico interactivo sin requerir X11.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
r
Área
data-visualization
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
30/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.