Skip to main content
L’intégration directe de figures Plotly ou Bokeh dans des tableaux n’est pas prise en charge. À la place, exportez les figures au format HTML et incluez ce HTML dans le tableau. Vous trouverez ci-dessous des exemples montrant comment procéder avec des graphiques Plotly et Bokeh interactifs.
import wandb
import plotly.express as px

# Initialiser un nouveau run
with wandb.init(project="log-plotly-fig-tables", name="plotly_html") as run:

    # Créer un tableau
    table = wandb.Table(columns=["plotly_figure"])

    # Définir le chemin de la figure Plotly
    path_to_plotly_html = "./plotly_figure.html"

    # Créer une figure Plotly
    fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])

    # Exporter la figure Plotly au format HTML
    # Définir auto_play sur False empêche les graphiques Plotly animés de se lancer automatiquement
    fig.write_html(path_to_plotly_html, auto_play=False)

    # Ajouter la figure Plotly au tableau en tant que fichier HTML
    table.add_data(wandb.Html(path_to_plotly_html))

    # Consigner le tableau
    run.log({"test_table": table})


Experiments Tables Graphiques