1. Log data to W&B
First, log data in your script. Use wandb.Run.config for single points set at the beginning of training, like hyperparameters. Use wandb.Run.log() for multiple points over time, and log custom 2D arrays withwandb.Table()
. We recommend logging up to 10,000 data points per logged key.
2. Create a query
Once you’ve logged data to visualize, go to your project page and click the+
button to add a new panel, then select Custom Chart. You can follow along in the custom charts demo workspace.

Add a query
- Click
summary
and selecthistoryTable
to set up a new query pulling data from the run history. - Type in the key where you logged the
wandb.Table()
. In the code snippet above, it wasmy_custom_table
. In the example notebook, the keys arepr_curve
androc_curve
.
Set Vega fields
Now that the query is loading in these columns, they’re available as options to select in the Vega fields dropdown menus:
- x-axis: runSets_historyTable_r (recall)
- y-axis: runSets_historyTable_p (precision)
- color: runSets_historyTable_c (class label)
3. Customize the chart
Now that looks pretty good, but I’d like to switch from a scatter plot to a line plot. Click Edit to change the Vega spec for this built in chart. Follow along in the custom charts demo workspace.
- add titles for the plot, legend, x-axis, and y-axis (set “title” for each field)
- change the value of “mark” from “point” to “line”
- remove the unused “size” field


Bonus: Composite Histograms
Histograms can visualize numerical distributions to help us understand larger datasets. Composite histograms show multiple distributions across the same bins, letting us compare two or more metrics across different models or across different classes within our model. For a semantic segmentation model detecting objects in driving scenes, we might compare the effectiveness of optimizing for accuracy versus intersection over union (IOU), or we might want to know how well different models detect cars (large, common regions in the data) versus traffic signs (much smaller, less common regions). In the demo Colab, you can compare the confidence scores for two of the ten classes of living things.
- Create a new Custom Chart panel in your Workspace or Report (by adding a “Custom Chart” visualization). Hit the “Edit” button in the top right to modify the Vega spec starting from any built-in panel type.
- Replace that built-in Vega spec with my MVP code for a composite histogram in Vega. You can modify the main title, axis titles, input domain, and any other details directly in this Vega spec using Vega syntax (you could change the colors or even add a third histogram :)
- Modify the query in the right hand side to load the correct data from your wandb logs. Add the field
summaryTable
and set the correspondingtableKey
toclass_scores
to fetch thewandb.Table
logged by your run. This will let you populate the two histogram bin sets (red_bins
andblue_bins
) via the dropdown menus with the columns of thewandb.Table
logged asclass_scores
. For my example, I chose theanimal
class prediction scores for the red bins andplant
for the blue bins. - You can keep making changes to the Vega spec and query until you’re happy with the plot you see in the preview rendering. Once you’re done, click Save as in the top and give your custom plot a name so you can reuse it. Then click Apply from panel library to finish your plot.

