Skip to content

Heatmap and Contour traces disappear with figure animation. #4491

Closed
@rottaj

Description

@rottaj

There is an issue with the heat map and contour plots when used as a trace with animations. Attached is some code; when run the heat-map disappears when animation begins.

`
scatterDf = pd.DataFrame({'Time': scatterDataX, 'Depth': scatterDataY, 'TimeShow': scatterTime})
print(scatterDf, 'DF')

fig = go.Figure()

data = [go.Scatter(
x=[],
y=[],
mode='markers',
marker=dict(color='blue')
)]

dataX = list(scatterDf['Time'])
dataY = list(scatterDf['Depth'])

frames = [dict(data= [dict(type='scatter',
x=dataX[:k+1],
y=dataY[:k+1])],
traces= [1],
name='frame{}'.format(k)
)for k in range(1, len(scatterDf))]

layout = go.Layout(
autosize=True,
hovermode='closest',
)

sliders = [dict(steps= [dict(method= 'animate',
args= [[ 'frame{}'.format(k) ],
dict(mode= 'immediate',
frame= dict( duration=100, redraw= False ),
transition=dict( duration= 0)
)
],
label='{:d}'.format(k)
) for k in range(len(scatterDf))],
transition= dict(duration= 0 ),
x=0,#slider starting position
y=0,
currentvalue=dict(font=dict(size=12),
prefix='Point: ',
visible=True,
xanchor= 'center'),
len=1.0)
]

layout.update(updatemenus=[dict(type='buttons', showactive=False,
y=0,
x=1.05,
buttons=[dict(label='Play',
method='animate',
args=[None,
dict(frame=dict(duration=100,
redraw=False),
transition=dict(duration=0),
fromcurrent=True, mode='immediate')
]
)
]
)
],
sliders=sliders)

fig = go.Figure(data=data, layout=layout, frames=frames)
fig.update_yaxes(autorange="reversed", range=[5000, -1000])
fig.add_heatmap(z=z2, zauto=False, zmin=-1, zmax=1)
fig.show()

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions