Home > Software engineering >  Set static colorscale to Plotly Heatmap animation
Set static colorscale to Plotly Heatmap animation

Time:10-29

I created a Heatmap animation, now I'm trying to set the colorscale in order to remain consistent with colors and values between frames. I read in this question that cmin and cmax could do the job, but heatmaps have not such parameters.
Is there any other way to obtain the same result?

I don't know if this can be helpful but here's my plotly Figure

framestamps = [go.Frame(data=[go.Heatmap(
    x=lon,
    y=lat,
    z=T_series['thetao'][i],
    colorscale='aggrnyl'
)]) for i in range(300)]


fig = go.Figure(
    data=[go.Heatmap(
        x=lon,
        y=lat,
        z=T_series['thetao'][0],
        colorscale='aggrnyl'
    )],
    layout=go.Layout(
        updatemenus=[dict(
            type='buttons',
            buttons=[dict(
                label='Play',
                method='animate',
                args = [None, {"frame": {"duration": 250,"redraw": True},
                                "fromcurrent": True}],
            )]
        )]
    ),
    frames=framestamps
)

CodePudding user response:

You can use zmin and zmax parameters of go.Heatmap.

  • Related