Hi everyone,
here I have an almost minimal working example for a Julia Plot that generates some heatmaps in one plot and has a slider to slide through all of them manually. However, the updatemenus attribute and with it the play button does not work, and I cannot find an example with a play button for Julia. When clicking the play button, it should automatically iterate through the heatmap subplots. I also asked about this on the Julia forum, however I did not succeed in translating working python/js examples into julia. Any help is greatly appreciated.
Thank you very much!
using PlotlyJS
#random matrices for heatmaps
Matrices = [rand(2,2) for i = 1 : 5]
colorscale = [[0, "white"], [1, "cyan"]]
# create the steps for the slider
steps = [attr(
method = "restyle",
label= "Heatmap $k",
args = [attr(
z= (Matrices[k], ),
colorscale=(colorscale, )
)])
for k= 1:length(Matrices)]
#generate the Plot data
maps = Plot(
heatmap(z=Matrices[1], colorscale=colorscale),
Layout(
width=400,
height=400,
margin_b=90,
sliders= [
attr(
active=0,
pad_t=20,
steps=steps
)
],
# add a button to automatically slide the slider
updatemenus=[
attr(
type="buttons",
buttons=[attr(
label="Play",
method="animate",
args=[nothing, attr(
frame=attr(duration=1000, redraw=true),
transition=attr(duration=0)
)] #end button args
)] #end buttons
) #end updatemenus attribute
] #end updatemenus
) #end layout
)
#display the plot data
display(maps)