plotly / plotly/plotly.R

ggplotly crashes when AGG is required as graphical engine

Đang mở
#2,286 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
R
Star
2.7k
Fork
641
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi từ ví dụ app.R được cung cấp, sử dụng công cụ đồ họa AGG của RStudio và lệnh gọi ggplotly(). Theo dõi lỗi X11 được báo cáo qua gg2list và xác minh rằng ứng dụng Shiny có thể kết xuất biểu đồ tương tác mà không yêu cầu X11.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
r
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.