Shiny - a black box appears when NULL returns in plotOutput

In the next very MWE, I get a black filled cell where the plot should be instead of nothing when I first start the source.

I am not saying anything because the table is not displayed (IMO is correct) until a button is pressed. I expect the same behavior for the graph, that is, until the button is pressed, all that will be on the screen is the button. What am I doing wrong?

library(shiny)

myUI = bootstrapPage( 
  actionButton(inputId="gobutton", label="Go"),
  plotOutput("plot"),
  tableOutput("table")
  )

mySERVER = function(input, output) {
  output$plot <- renderPlot({ 
    if(input$gobutton==0) {return(NULL)}
    hist(runif(100))
  })
  output$table <- renderTable({ 
    if(input$gobutton==0) {return(NULL)}
    data.frame(x=runif(10), y=seq(1:10))
  })

}

runApp(list(
  ui = myUI,
  server = mySERVER
  ))

I use Firefox and the latest stable R and brilliant.

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_GB.utf8        LC_COLLATE=en_GB.utf8    
 [5] LC_MONETARY=en_GB.utf8    LC_MESSAGES=en_GB.utf8   
 [7] LC_PAPER=en_GB.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C      

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

other attached packages:
[1] shiny_0.8.0

loaded via a namespace (and not attached):
[1] bitops_1.0-6  Cairo_1.5-5   caTools_1.16  digest_0.6.4  httpuv_1.2.2 
[6] Rcpp_0.11.0   RJSONIO_1.0-3 tools_3.0.2   xtable_1.7-1
+3
source share
1 answer

I think this is due to the Cairo package.

Cairo is not installed on my system. If I ran your code in Firefox with a fresh R session, there was no black box (only the GO button).

. , .

Cairo detach("package:Cairo", unload=T): .

R : .

Cairo remove.packages("Cairo") R: .

, , Shiny Cairo, , , .

+2

All Articles