Skip to main content
L’intégration directe de figures Plotly ou Bokeh dans des tableaux n’est pas prise en charge. Exportez plutôt les figures au format HTML et incluez ce HTML dans le tableau. Les exemples suivants montrent comment procéder avec des graphiques Plotly et Bokeh interactifs.
import wandb
import plotly.express as px

# Initialiser une nouvelle exécution
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 en tant que fichier HTML au tableau
    table.add_data(wandb.Html(path_to_plotly_html))

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


Experiments Tables Graphiques