I am trying to log a 3d scatter plotly plot every nth iteration. I followed this tutorial Log and Track Plots from W&B Experiments. to convert the plot into an HTML, add it to a table and then log it. However, in my wandb dashboard, only a single row shows up, so it seems like the table gets overwritten. Ideally, I would like a slider to go through the plots, but having them all in a table would already be better than what I have right now. Here is my code:
density_plot_wandb_table = wandb.Table(columns=["electron_densities"])
for step in trange(init_step, config.train.n_steps):
...
if step%config.plotting.n_plotting_frequency==0:
# Create plot
fig = go.Figure(data=[go.Scatter3d(x=samples[:config.plotting.n_samples, 0],
y=samples[:config.plotting.n_samples, 1],
z=samples[:config.plotting.n_samples, 2],
mode='markers',
marker=dict(
size=1,
color='#636EFA',
opacity=0.2
)
),
go.Scatter3d(x=mol.nuclei_position[:, 0],
y=mol.nuclei_position[:, 1],
z=mol.nuclei_position[:, 2],
mode='markers',
marker=dict(
size=7,
color='crimson',
opacity=1.0
)
)
])
fig.write_html('{}plots_{}'.format(workdir, step), auto_play=False)
density_plot_wandb_table.add_data(wandb.Html('{}plots_{}'.format(workdir, step)))
wandb.log({'Mol': density_plot_wandb_table})