Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Specifying Attribute While Operating Sliders

I am starting with a 3D array which contains a series of camera images that I would like to display depending on the slider setting.

My idea was to set the desired image as visible, much like the slider example, with the data set up as follows:

allframes is the array of images

data = [dict(
visible = False,
name = 'frame ’ + str(step),
z = allframes[step]) for step in range(0,len(f[‘frames’]))
]

When I try to plot this with the following:

steps = []
for i in range(0,len(f[‘frames’])):
step = dict(
method = ‘restyle’,
args = [‘visible’, [False] * len(f[‘frames’])],
)
step[‘args’][1][i] = True
steps.append(step)

sliders = [dict(
active = 10,
currentvalue = {“prefix”: "Frequency: "},
pad = {“t”: 50},
steps = steps
)]

layout = dict(sliders=sliders)
fig = dict(data=data, layout=layout)
py.iplot(fig, filename=‘All Frames’)

I get an error message relating to the fact my data is not a scatterplot. I understand that I can plot a single heatmap by:

trace = go.Heatmap(z = allframes[1])
data = [trace]
py.iplot(data, filename = ‘basic-heatmap’)

But I do not know how to specify a heatmap for my slider. Can someone direct me either to more documentation about how the sliders work or tell me how I can specify that I want a heatmap rather than a scatterplot?