> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-sandboxes-integrations-placement.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

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

Create a multi-line custom chart with `wandb.plot.line_series()`. Go to the [project page](/models/track/project-page) to view the line chart. To add a legend, include the `keys` argument in `wandb.plot.line_series()`. For example:

```python theme={null}
with wandb.init(project="my_project") as run:
    run.log(
        {
            "my_plot": wandb.plot.line_series(
                xs=x_data, ys=y_data, keys=["metric_A", "metric_B"]
            )
        }
    )
```

For more details about multi-line plots, see the [basic charts documentation](/models/track/log/plots#basic-charts) under the **Multi-line** tab.

***

<Badge stroke shape="pill" color="orange" size="md">[Experiments](/support/models/tags/experiments)</Badge>
