How to show legend in plots of individual runs?

Hi, around 2 weeks ago I noticed that legends no longer appear for me in the charts of my individual runs. Is this by design, a configuration issue or a bug? I created an example project of this issue here: Weights & Biases using the sample code wandb provides for blank projects:

import wandb
import random

# start a new wandb run to track this script
wandb.init(
    # set the wandb project where this run will be logged
    project="no-legends-in-run",
    entity="niklasz",
    # track hyperparameters and run metadata
    config={
        "learning_rate": 0.02,
        "architecture": "CNN",
        "dataset": "CIFAR-100",
        "epochs": 10,
    }
)

# simulate training
epochs = 10
offset = random.random() / 5
for epoch in range(2, epochs):
    acc = 1 - 2 ** -epoch - random.random() / epoch - offset
    loss = 2 ** -epoch + random.random() / epoch + offset

    # log metrics to wandb
    wandb.log({"acc": acc, "loss": loss})

# [optional] finish the wandb run, necessary in notebooks
wandb.finish()

I also tried toggling the legend in the editing menu for a chart, but this had no effect:

Would appreciate some advice here

Hi @niklasz! Thank you for writing in!

Would you be interested in seeing your legend? I remember our product team mentioning these changes for a single-line graphs. But I wasn’t sure if we were going to release them or not.

Thanks for your answer @artsiom! Unfortunately I also can’t get legends to appear in multi-line plots either. I updated the above example project to include both the loss and acc lines:

For additional context: I have more complex line plots in my research projects with anything from 1-20 lines and cannot get a legend to appear for any of them. That’s why I’m wondering whether this is a bug or feature.

Thank you so much for elaborating! Could you please point me to the workspace where you are experiencing this behavior?

Please use the example one I referenced at the start. I was able to reproduce the issue there: Weights & Biases

I see it on my side as well! I will check internally if this behavior is intended or not.

Hi Niklas! I have checked internally and it does look like it is intended. Would you like me to submit a feature request for you to add the legend back to single runs?

2 Likes

Why it was removed ? I have the options to select the position of the legend (north, east, etc.) but it does not display on the plot.
Please if it is within your possibilities Id like you to submit a feature request

Hi Artsiom,

Yes, please create a feature request.

In case a use case is helpful, here is mine: I conduct multi-agent reinforcement learning experiments and use Wandb to track metrics about each agent during a training run. To compare how agents are doing, I like to put their metrics together in one plot. Here is an example for the number of games (episodes) each agent has trained:

It would be useful if I could have a legend that tells me which line is which agent without having to hover over the plot itself. That said, I can also see plenty of other use-cases that are less niche like tracking different types of training loss in one plot. Hope this helps!

Hey guys! Thank you for elaborating!

I have submitted the feature request to our engineering and product teams. Now it’s time to wait for their feed back. Thank you so much for your patience, this is a strange behavior indeed.