How do I plot multiple lines on a plot with a legend?

Create a multi-line custom chart with wandb.plot.line_series(). Navigate to the project page to view the line chart. To add a legend, include the keys argument in wandb.plot.line_series(). For example:

wandb.log(
    {
        "my_plot": wandb.plot.line_series(
            xs=x_data, ys=y_data, keys=["metric_A", "metric_B"]
        )
    }
)

Refer to additional details about multi-line plots here under the Multi-line tab.


Last modified February 1, 2025: 1dc8b96