plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

The color of Scattergl points are missing when using animation

Open xuxiaoxxxx opened this issue 1 year ago • 1 comments

import plotly.graph_objects as go

fig = go.Figure(
    data=[go.Scattergl(x=[0, 1], y=[0, 1])],
    layout=go.Layout(
        xaxis=dict(range=[0, 5], autorange=False),
        yaxis=dict(range=[0, 5], autorange=False),
        title="Start Title",
        updatemenus=[dict(
            type="buttons",
            buttons=[dict(label="Play",
                          method="animate",
                          args=[None])])]
    ),
    frames=[go.Frame(data=[go.Scattergl(x=[1, 2], y=[1, 2])]),
            go.Frame(data=[go.Scattergl(x=[1, 4], y=[1, 4])]),
            go.Frame(data=[go.Scattergl(x=[3, 4], y=[3, 4])],
                     layout=go.Layout(title_text="End Title"))]
)
fig.update_layout(showlegend=False)
fig.show()

the visualization is shown as below: (https://github.com/plotly/plotly.py/assets/55653936/29679f73-06e7-43dd-80ae-1c7d7636f29d)

When I execute the above code, only the first frame line segment has normal color, and the other frame line segments have no color.

xuxiaoxxxx avatar Apr 01 '24 12:04 xuxiaoxxxx

codepen to replicate the error in js.

Potentially tied to #3243

Thanks for reporting @xuxiaoxxxx

Coding-with-Adam avatar Apr 05 '24 17:04 Coding-with-Adam

Hi everyone. I can confirm that apparently it is not possible to animate Scattergl plots. After changing my plots to Scatter, everything works as expected. The need for using Scattergl plots is related to a "background plot (with many elements)" I need to use behind the points that change over the time. By the way, I am declaring the background plots in every Frame in the data parameter. If there is another approach for this, I will appreciate it a lot. Thanks!

output

felipecordero avatar May 26 '24 16:05 felipecordero