✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Plotly html export issue

I’m not sure if its me not configuring the export properly or if its a bug with the python api.

I’m trying to export an interactive plot (composed of multiple slides) with the function .write_hrml('location') while in a jupyter notebook (not jupyter lab, notebook while using vs code with its python package)

the issue is that while in the notebook everything behaves properly and the plot shows the corresponding information, but when I export the plot to html the generated file shows the last slide in the carusel to be the same as the first one instead of showing the appropiate slide.

What I get in the notebook (what it should look like) is:

What it looks like in the html file:

I’m using plotly version: 4.10.0 build: pyh9f0ad1d_0
and: nbformat version: 5.0.7 build: py_0

The code Im using to genetarte the plot is as folows:

nb_frames = 8
fig = go.Figure()

colorscale = [[(float(i) + 5)/100, ('rgb({}, {}, 0)').format( 250 - i*10, i*10)] for i in range(25)]

fig = go.Figure( frames= [go.Frame(data= go.Heatmap(z= numpy_3d_array[:,:,k]), name= str(k)) for k in range(nb_frames)])

for frame in range(nb_frames):
    fig.add_trace( go.Heatmap(z = numpy_3d_array[:,:, frame],x= [i + 10 for i in range(15)],y= [i*2 + 20 for i in range(20)], zmin= 0.1, zmax=0.25,colorscale= 'RdYlGn',  visible= False))
fig.data[0].visible = True


steps = []
for i in range(nb_frames):
    step = dict(
        method= "update",
        args= [{'visible': [False] * len(fig.data)},
            {'title':'some_title: ' + str(i)}],
        
            )
    step['args'][0]['visible'][i] = True
    steps.append(step)

sliders = [dict(
    active= 0,
    pad= {'t': 10},
    steps= steps
)]


fig.update_layout(sliders=sliders, xaxis_title= "x", yaxis_title= "y")
fig.show()

fig.write_html('/location/file.html')