ggplotly crashes when AGG is required as graphical engine
Personne n'a encore pris cette issue.
- Langage dominant
- R
- Étoiles
- 2.7k
- Forks
- 641
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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)
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire l’échec à partir de l’exemple app.R fourni avec le moteur graphique AGG de RStudio et l’appel ggplotly(). Suivez l’erreur X11 signalée via gg2list et vérifiez que l’application Shiny peut afficher le graphique interactif sans nécessiter X11.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- r
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 30/100