Skip to main content
Create visually meaningful line plots and plot legends by color-coding your W&B runs based on metrics or configuration parameters. Identify patterns and trends across experiments by coloring runs according to their performance metrics (highest, lowest, or latest values). W&B automatically groups your runs into color-coded buckets based on the values of your selected parameter. To use metric- or configuration-based colors for your runs, you need to configure two values a Key and a Y value. Use the key to specify the metric or config value you want to use. Use the Y value to specify the buckets W&B uses to assign colors. The following sections describe how to enable key-based colors, choose a metric or configuration key, set a Y value, and customize the buckets W&B uses to assign colors.

Turn on key-based colors

Enable key-based colors so W&B can assign run colors based on a metric or configuration key instead of the default per-run colors.
  1. Navigate to your W&B project.
  2. Select the Workspace tab from the project sidebar.
  3. Click the Settings icon in the top right corner.
  4. From the drawer, select Runs.
  5. In the Run colors section, select Key-based colors.
  6. Configure the following options:
    • From the Key dropdown, select the metric or config value you want to use for assigning colors to runs.
    • From the Y value dropdown, select the Y value you want to use for assigning colors to runs.
    • Set the number of buckets to a value from 2 to 8.
When you use key-based colors, the option to customize run colors isn’t available.
After you turn on key-based colors, W&B colors each run based on the key and Y value you selected. The following sections describe how to set the metric and Y value and how to customize the buckets that W&B uses to assign colors to runs.

Example: key-based colors with a loss metric

In this example plot, W&B colors runs with a gradient where darker colors represent higher loss values and lighter colors represent lower loss values. The Y value is set to Latest to use the most recent loss value for each run.

Set a metric

Choose a metric to base your run colors on. The metric options in your Key dropdown come from the custom metrics you log to W&B and the default metrics that W&B defines.

Default metrics

  • Relative Time (Process): The relative time of the run, measured in seconds since the start of the run.
  • Relative Time (Wall): The relative time of the run, measured in seconds since the start of the run, adjusted for wall clock time.
  • Wall Time: The wall clock time of the run, measured in seconds since the epoch.
  • Step: The step number of the run, which is typically used to track the progress of training or evaluation.

Custom metrics

Color runs and create meaningful plot legends based on custom metrics that your training or evaluation scripts log. You log custom metrics as key-value pairs, where the key is the name of the metric and the value is the metric value. For example, the following code snippet logs accuracy ("acc" key) and loss ("loss" key) during a training loop:
Within the Key dropdown, both "acc" and "loss" are available options.

Set a configuration key

Color runs based on a configuration key such as a hyperparameter. The configuration options in your Key dropdown come from the key-value pairs you pass to the config parameter when you initialize a W&B run. Use configuration keys to log hyperparameters or other settings used in your training or evaluation scripts.
Within the Key dropdown, "learning_rate", "batch_size", and "optimizer" are available options.

Set a Y value

After you select a key, set a Y value to control which value of the selected metric or config value drives the color assignment. The Y value determines which value W&B uses to assign a color to each run. You can choose from the following options:
  • Latest: Determines color based on Y value at the last logged step for each line.
  • Max: Determines color based on the highest Y value logged against the metric.
  • Min: Determines color based on the lowest Y value logged against the metric.

Customize buckets

Adjust the number of buckets to control how finely W&B groups your runs by value. Buckets are ranges of values that W&B uses to categorize runs based on the metric or configuration key you select. W&B distributes buckets evenly across the range of values for the specified metric or configuration key and assigns each bucket a unique color. W&B displays runs that fall within a bucket’s range in that color. Consider the following example:
Run colors settings with Key set to acc and Y value set to Max, showing six buckets across the accuracy range.
  • Key is set to "Accuracy" (abbreviated as "acc").
  • Y value is set to Max.
With this configuration, W&B colors each run based on its accuracy value. The colors vary from light yellow to deep purple. Lighter colors represent lower accuracy values, while deeper colors represent higher accuracy values. W&B defines six buckets for the metric, with each bucket representing a range of accuracy values. The Buckets section defines the following range of buckets:
  • Bucket 1: (Min to 0.7629)
  • Bucket 2: (0.7629 to 0.7824)
  • Bucket 3: (0.7824 to 0.8019)
  • Bucket 4: (0.8019 to 0.8214)
  • Bucket 5: (0.8214 to 0.8409)
  • Bucket 6: (0.8409 to Max)
In the following line plot, the run with the highest accuracy (0.8232) appears in a deep purple (Bucket 5), while the run with the lowest accuracy (0.7684) appears in a light orange (Bucket 2). W&B colors the other runs based on their accuracy values, with the color gradient indicating their relative performance.
Line plot with runs colored by accuracy, from light orange for lower values to deep purple for higher values.