Skip to contents

plotly writes visible into every trace of every animation frame, so a trace hidden with a click on the legend comes back on the next frame. This removes visible from the frames, so the click lasts while the animation plays. plotly also hides a trace, with visible = FALSE, in a frame where it has no data, as a copy of its previous frame; that copy is emptied instead, so nothing is drawn there.

Usage

keep_legend_clicks(p)

Arguments

p

A plotly object with frames.

Value

The built plotly object.

Examples

keep_legend_clicks(plot_pyramid(mfi_population, country = "Greece", font_style = font_style))