简体   繁体   English

将静态色阶设置为 Plotly Heatmap 动画

[英]Set static colorscale to Plotly Heatmap animation

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.我在这个问题中读到 cmin 和 cmax 可以完成这项工作,但热图没有这样的参数。
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
)

您可以使用zminzmax的参数go.Heatmap

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM