Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render ggplotly graphic - unable to start device #2347

Open
ochee opened this issue Apr 16, 2024 · 1 comment
Open

render ggplotly graphic - unable to start device #2347

ochee opened this issue Apr 16, 2024 · 1 comment

Comments

@ochee
Copy link

ochee commented Apr 16, 2024

Hello,

I try to plot dynamic graphs in a simple dashboard page, here a simple example:

ui.r part

library(shiny)
library(ggplot2)
library(plotly)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title = "Basic dashboard"),
  dashboardSidebar(),
  dashboardBody(
    fluidRow(
	  plotlyOutput("plot3")
)
)
)

and server.r part

server <- function(input, output) { 
  output$plot3 <- renderPlotly({

  g <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
  stat_density_2d(aes(fill = ..level..), geom = "polygon") + 
  xlim(1, 6) + ylim(40, 100)
  ggplotly(g)
  })
}

This app renders an error : unable to start PNG device.
Do you think is it a problem with my R session and versions of packages ?

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so

locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] maptiles_0.7.0 sf_1.0-8

loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 magrittr_2.0.3 units_0.8-0 tidyselect_1.2.0
[5] R6_2.5.1 rlang_1.1.1 fansi_1.0.4 dplyr_1.1.2
[9] tools_4.1.2 grid_4.1.2 KernSmooth_2.23-20 utf8_1.2.3
[13] terra_1.6-17 cli_3.6.1 e1071_1.7-12 DBI_1.1.3
[17] class_7.3-20 tibble_3.2.1 lifecycle_1.0.3 codetools_0.2-18
[21] vctrs_0.6.3 glue_1.6.2 proxy_0.4-27 compiler_4.1.2
[25] pillar_1.9.0 generics_0.1.3 classInt_0.4-8 pkgconfig_2.0.3

Many thanks,

@cpsievert
Copy link
Collaborator

Can you recreate the error outside of shiny?

library(plotly)
g <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
  stat_density_2d(aes(fill = ..level..), geom = "polygon") + 
  xlim(1, 6) + ylim(40, 100)
ggplotly(g)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants