Error creating graphs unable to start png() device

3,174 views
Skip to first unread message

cristofer...@gmail.com

unread,
Sep 21, 2018, 8:21:05 AM9/21/18
to Shiny - Web Framework for R
Hi everybody,

I am having problems to create graphs in shiny App,  I can do a plot in my Rstudio session using ggplot.

Problem starts when I try to connect to shiny using this code::

ui<-fluidPage(
  selectInput(inputId = "Mercado", label ="Selecciona Mercado:",
              choices=as.character(unique(BBDD$mercado))),
  selectInput(inputId = "Canal", label ="Selecciona Canal:",
              choices=as.character(unique(BBDD$canal))),
  tableOutput("contrib")

)

server<-function(input,output){
  
  output$contrib<-renderPlot({
    
      contrib.graph<-(ggplot() + geom_area(aes(y=value,x=Fecha,fill=typecontribution), data = data.to.plot[data.to.plot$groups=="AOc_CAT",],stat="identity",position_stack(reverse = T))+
      scale_x_date(date_labels="%Y%m", date_breaks="3 month", expand=c(0,0)) +
      ggtitle("AOc_CAT"))  
      contrib.graph
  })
}

shinyApp(ui=ui,server=server)

---------------------------------------------------------------------------------------
 first I get this error:

Warning in pngfun(filename = filename, width = width, height = height, res = res,  :
  unable to allocate bitmap
Warning in pngfun(filename = filename, width = width, height = height, res = res,  :
  opening device failed
Warning: Error in pngfun: unable to start png() device
  [No stack trace available]

--------------------------------------------------------------------------------------

and if I execute this:options(shiny.usecairo=TRUE)

Warning: Error in Cairo: Failed to create Cairo backend!


I have been looking for solutions on google but nothing, I hope someone can giv eme hand

Thanks

Cristofer
Rplot.png

cristofer...@gmail.com

unread,
Sep 21, 2018, 8:23:18 AM9/21/18
to Shiny - Web Framework for R
Also I have executed this line

capabilities()
       jpeg         png        tiff       tcltk         X11        aqua    http/ftp     sockets      libxml        fifo      cledit       iconv 
       TRUE        TRUE        TRUE        TRUE       FALSE       FALSE        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
        NLS     profmem       cairo         ICU long.double     libcurl 
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
Message has been deleted

Jakub Wiatrak

unread,
Oct 9, 2018, 8:15:56 AM10/9/18
to Shiny - Web Framework for R
Change tableOutput("contrib") to plotOutput("contrib"). This should help :)
Reply all
Reply to author
Forward
0 new messages