Blinking ggplot in shiny R app
<p>I'm doing a small shiny app that only has one ggplot that is updated every couple of seconds. It works, but the blinking is a bit annoying. I wonder if anyone has an idea about how to smooth it out. Example:</p>

<pre><code>library(shiny)
library(ggplot2)

server &lt;- shinyServer(function(input, output, session) {


    output$showplot &lt;- renderPlot({
        grid &lt;- expand.grid(1:3,1:3)
        nums &lt;- rbinom(9,1,0.5)
        g &lt;- ggplot(grid,aes(Var1,Var2)) + 
            geom_tile(aes(fill = nums),colour="black") +
            guides(fill = FALSE) +
            theme(axis.title.x=element_blank(), axis.text.x=element_blank(), axis.ticks.x=element_blank()) + 
            theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) + 
            theme(aspect.ratio=1)

        print(g)

        invalidateLater(1000,session)
   })

})

ui &lt;- shinyUI(fluidPage(

    sidebarLayout(
        sidebarPanel(

        ),

    mainPanel(
        h5("Plot blinking"),
        plotOutput("showplot")
    )
)
))

runApp(list(ui = ui, server = server))
</code></pre>

<p>I should add that while looking around for a similar question, the solution provided was adding </p>

<pre><code>tags$style(type="text/css",
    ".recalculating {opacity: 1.0;}" ),
</code></pre>

<p>as the first item in FluidPage. This doesn't seem to work for my case. </p>