Hi @mbp thanks for writing in! Would it work for you to add a slider instead for your Plotly figures as follows:
import plotly.graph_objects as go
import numpy as np
for i in range(3):
x = np.linspace(0, 10, 100)
y = np.sin(x) + np.random.normal(0, 0.1, 100)
fig = go.Figure(data=go.Scatter(x=x, y=y))
plot = wandb.Plotly(fig)
wandb.log({"examples_2": plot}, step = i)
Another alternative would be to convert the Plotly to html and add them in a wandb.Table, for example:
# Create a table
table = wandb.Table(columns = ["plotly_figure"])
for i in range(3):
x = np.linspace(0, 10, 100)
y = np.sin(x) + np.random.normal(0, 0.1, 100)
fig = go.Figure(data=go.Scatter(x=x, y=y))
# Create path for Plotly figure
path_to_plotly_html = "./plotly_figure.html"
# Write Plotly figure to HTML
fig.write_html(path_to_plotly_html, auto_play = False)
# Add Plotly figure as HTML file into Table
table.add_data(wandb.Html(path_to_plotly_html))
wandb.log({"examples_3": table})
Would any of these options work for your use case?
Thank you for your reply. When doing it this way the plots do not show up in the UI at all, unfortunately. I can see them in the files section unter root/media/plotly but they cannot be added to the charts section.
By chance, I tried to log the plots one by one without the step=i part and then they showed up in the charts section with a slider. Could you clarify if that is the intended way to do it maybe?
Hi @mbp thanks for the update, could you please try to Add Panel > Plotly and then add in media keys the key you had used to log the plots (for instance in the code snippet above that would be examples_2). Would this work for you?
Hi @thanos-wandb, thanks for your reply. I’m sorry that I did not mention it explicitly but I have tried to add it manually before and the problem is, that the key does not exist in the backend. Here is an excerpt from my code:
_fs = self.log_pred_probs(
y_train_pred_prob, y_test_pred_prob, threshold=0.5, n_plots=20
)
for i, _f in enumerate(_fs):
_pf = wandb.Plotly(_f)
run.log({"prediction_probabilities": _pf}, step=i)
Hi @mbp thanks for the additional details, this shouldn’t be the expected behaviour. Are you logging in our SaaS (wandb.ai) or in a local W&B instance? If the former could you please send us a link to your Workspace (or email it to support@wandb.com in case you don’t want to publicly share), or in the latter case please provide us with your Local/Server version (found from <host-url>/settings page).
Hi @mbp thanks for the additional details, that’s important to know you’re on a self-hosted instance. I have tested it as well though in a 0.30.0 deployment and it worked for me. Could you please try the following code again (in a completely new project)?
import wandb
import plotly.graph_objects as go
import numpy as np
wandb.init(project='plotly')
for i in range(3):
x = np.linspace(0, 10, 100)
y = np.sin(x) + np.random.normal(0, 0.1, 100)
fig = go.Figure(data=go.Scatter(x=x, y=y))
plot = wandb.Plotly(fig)
wandb.log({"examples_2": plot}, step = i)
wandb.finish()
Please let me know if this still won’t work for you. I will then try to reproduce if the issue occurs because you logged the data in 0.29.0 and then you upgraded to 0.30.0.