Skip to main content
In W&B Models, methods in wandb.plot let you track charts with wandb.Run.log(), including charts that change over time during training. To learn more about the custom charting framework, see the custom charts walkthrough.

Basic charts

To create a W&B chart:
  1. Create a wandb.Table object and add the data you want to visualize.
  2. Generate a plot using one of the W&B’s built-in helper functions
  3. Log the plot with wandb.Run.log().
The following basic charts can be used to construct basic visualizations of metrics and results.
Log a custom line plot, a list of connected and ordered points on arbitrary axes.
You can use this to log curves on any two dimensions. If you’re plotting two lists of values against each other, the number of values in the lists must match exactly. For example, each point must have an x and a y.
Custom line plot
For more information, see the Creating Custom Line Plots With W&B report.Run the code

Model evaluation charts

These preset charts have built-in wandb.plot() methods that make it quick to log charts directly from your script and see the exact information you’re looking for in the UI.
Create a Precision-Recall curve in one line:
You can log this whenever your code has access to:
  • A model’s predicted scores (predictions) on a set of examples.
  • The corresponding ground truth labels (ground_truth) for those examples.
  • (Optional) A list of the labels or class names. For example, labels=["cat", "dog", "bird"], if label index 0 means cat, 1 means dog, 2 means bird.
  • (Optional) A subset (still in list format) of the labels to visualize in the plot.
Precision-recall curve
For more information, see the Plot Precision Recall Curves With W&B report.Run the code

Interactive custom charts

For full customization, tweak a built-in Custom Chart preset or create a new preset, then save the chart. Use the chart ID to log data to that custom preset directly from your script.
Run the code

Matplotlib and Plotly plots

Instead of using W&B Custom Charts with wandb.plot(), you can log charts generated with matplotlib and Plotly.
Pass a matplotlib plot or figure object to wandb.Run.log(). By default we’ll convert the plot into a Plotly plot. If you’d rather log the plot as an image, you can pass the plot into wandb.Image. We also accept Plotly charts directly.
If you get an error like “You attempted to log an empty plot”, store the figure separately from the plot with fig = plt.figure() and then log fig in your call to wandb.Run.log().

Log custom HTML to W&B Tables

W&B supports logging interactive charts from Plotly and Bokeh as HTML and adding them to Tables.

Log Plotly figures to Tables as HTML

You can log interactive Plotly charts to W&B Tables by converting them to HTML.

Log Bokeh figures to Tables as HTML

You can log interactive Bokeh charts to W&B Tables by converting them to HTML.