How can I stop renderplot from blinking?

1,578 views
Skip to first unread message

ttzz

unread,
Feb 20, 2015, 1:08:31 PM2/20/15
to shiny-...@googlegroups.com
I am implementing a live plot that updates it self using renderplot and reactivepoll. My problem is that when the plot gets complicated, it blinks in between render plots. (The first plot becomes lighter, and after half a second, the second plot shows.) I'm wondering if there is a way to make it not blink. For example, make the original plot stay there until the next plot is fully rendered and then make the second plot appear. I have tried using print(plot,newpage=F), it improved the performance a lot but it still blinks.  

Winston Chang

unread,
Feb 23, 2015, 3:17:49 PM2/23/15
to ttzz, shiny-discuss
What browser are you using? Also, does this happen when you try it on other browsers?

On Fri, Feb 20, 2015 at 10:08 AM, ttzz <zhao....@gmail.com> wrote:
I am implementing a live plot that updates it self using renderplot and reactivepoll. My problem is that when the plot gets complicated, it blinks in between render plots. (The first plot becomes lighter, and after half a second, the second plot shows.) I'm wondering if there is a way to make it not blink. For example, make the original plot stay there until the next plot is fully rendered and then make the second plot appear. I have tried using print(plot,newpage=F), it improved the performance a lot but it still blinks.  

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/d9f4a636-3aa7-4792-881a-38f41d561f23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Greg L

unread,
Feb 24, 2015, 4:15:08 PM2/24/15
to shiny-...@googlegroups.com
Try converting your plots to an image and then outputting that image? Not exactly sure what you're talking about without an example, but I solved what may be a similar problem like this.

Joe Cheng

unread,
Feb 24, 2015, 4:29:03 PM2/24/15
to Greg L, shiny-...@googlegroups.com
Add this CSS somewhere in your UI:

tags$style(type="text/css", "#output_id.recalculating { opacity: 1.0; }")

where output_id should be replaced by the output ID of the plot in question.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

Greg L

unread,
Feb 24, 2015, 5:58:13 PM2/24/15
to shiny-...@googlegroups.com, ggll...@gmail.com
thanks, this helped me out as well. and I think it's exactly what OP was looking for.

Joe Cheng

unread,
Feb 24, 2015, 6:09:12 PM2/24/15
to Greg L, shiny-...@googlegroups.com
Just to be clear about what this is doing:

We consider it a feature, that Shiny makes partially transparent any output that is being recalculated. This is so that when the user moves a slider to a new value, they don't mistake an old plot output for the correct updated value.

This style tag just undoes that effect by overriding the rule that we put in for lowering the opacity, specifically for a single input. You can also remove the "#output_id" section if you want to override this effect for ALL outputs in a Shiny app.

dnros...@ucdavis.edu

unread,
Jul 17, 2015, 12:32:38 PM7/17/15
to shiny-...@googlegroups.com, ggll...@gmail.com
Hi Joe,

This CSS line for renderPlot was helpful, but I also need help preventing the blinking in a renderLeaflet plot. Do you have a suggestion for what the CSS line should be? Currently, the following is not working:


box(width = 1100,title="Map", solidHeader=TRUE, status="success", leafletOutput("mymap", height =450, width = 1100 ),
                         tags$style(type="text/css", "#mymap.recalculating { opacity: 1.0; }")
                     ) 

I have a feeling it might be the type = "text/css" should be something else for leaflet, but would really appreciate if you or anyone has any ideas!

Joe Cheng

unread,
Jul 17, 2015, 1:56:19 PM7/17/15
to dnros...@ucdavis.edu, shiny-...@googlegroups.com, ggll...@gmail.com
Hmmm, maybe try 1.0 !important instead of 1.0 for the opacity.

Danielle Rosenberg

unread,
Jul 17, 2015, 4:25:46 PM7/17/15
to Joe Cheng, shiny-...@googlegroups.com, ggll...@gmail.com
Tried tags$style(type="text/css", "#mymap.recalculating { opacity: 1.0 !important; }") but still didn't stop the blinking. Any other ideas?
Reply all
Reply to author
Forward
0 new messages