Hey Guys,
Can you have a quick check at what I am doing wrong here. I am attempting two have two subplots controlled by the same slider with data from two different lists. I have already written some pipeline but canβt seem to get this working. Heatmap has a problem with scale (see images)
I have had a look at some of the other questions about this topic and cant seem to get it working.
import torch
import plotly.graph_objects as go
from plotly.subplots import make_subplots
epochs = [i for i in range(61)]
data = [torch.randn(10, 15) for i in range(61)]
flat_data = [tensor.flatten() for tensor in data]
fig = make_subplots(rows=1, cols=2)
fig.add_trace(go.Histogram(x=flat_data[0], histfunc="count"), row=1, col=1)
fig.add_trace(go.Heatmap(z=data[0], colorscale='RdBu_r', zmid=0), row=1, col=2)
steps = []
for i, epoch in enumerate(epochs):
step = dict(
method="restyle",
args=[{"z": [data[i]], "x": [flat_data[i]]}],
label=str(epoch)
)
steps.append(step)
sliders = [dict(
active=0,
currentvalue={"prefix":"Epoch: "},
pad={"t": 50},
steps=steps
)]
fig.update_layout(
autosize=False,
sliders=sliders,
width=500,
height=500,
)
fig.show()
Normal variant without slider