Plotly animation_frame does not work in Shiny

I'm trying to create a Plotly figure with animation_frame. It all works fine when I'm running it in as a single plot in a separate file with fig.show(), but not within Shiny.

Here's my code:

    @render_widget
    def vaccinated_by_group():
        df = px.data.gapminder()
        fig = px.scatter(df, 
						 x="gdpPercap", 
						 y="lifeExp", 
						 animation_frame="year", 
						 animation_group="country",
                         size="pop", 
						 color="continent", 
						 hover_name="country",
                         log_x=True, 
						 size_max=55, 
						 range_x=[100, 100000], 
						 range_y=[25, 90])
        return fig

The figure is visible, and I can drag the slider and click the play and stop buttons, but nothing happens, ie the figure is not updated accordingly. I guess I could move the year slider to Shiny using the input_slider. This, however, would result in the plot being updated every time the user drags the slider and thus have a huge negative effect on user friendliness.

I've tried the approach described here: Animated Plotly Graph in PyShiny (Express) without success.

Any help would be greatly appreciated.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.