Edit on GitHub

plots show

Generate a plot image from from a plot metrics file.


usage: dvc plots show [-h] [-q | -v] [-t [TEMPLATE]] [-f FILE]
                     [-s SELECT] [-x X] [-y Y] [--stdout]
                     [--no-csv-header] [--no-html] [--title TITLE]
                     [--xlab XLAB] [--ylab YLAB] [datafile]

positional arguments:
  datafile              Metrics file to visualize


This command provides a quick way to visualize metrics such as loss functions, AUC curves, confusion matrices, etc. Please see dvc plots for information on the supported data formats and other relevant details about DVC plots.


  • -t [TEMPLATE], --template [TEMPLATE] - plot template to be injected with data. The default template is .dvc/plots/default.json. See more details in dvc plots.
  • -f FILE, --file FILE - name of the generated file. By default, the output file name is equal to the input filename with additional .html suffix or .json suffix for --no-html mode.
  • --no-html - do not wrap output Vega specification (JSON) with HTML.
  • -x X - field name for X axis. An auto-generated index field is used by default.
  • -y Y - field name for Y axis. The last column or field found in the datafile is used by default.
  • -s SELECT, --select SELECT - select which fields or JSONPath to store in the metrics file metadata. The auto-generated, zero-based index column is always included.
  • --xlab XLAB - X axis title. The X field name is the default title.
  • --ylab YLAB - Y axis title. The Y field name is the default title.
  • --title TITLE - plot title.
  • -o, --stdout - print plot content to stdout.
  • --no-csv-header - provided CSV or TSV datafile does not have a header.
  • -h, --help - prints the usage/help message, and exit.
  • -q, --quiet - do not write anything to standard output. Exit with 0 if no problems arise, otherwise 1.
  • -v, --verbose - displays detailed tracing information.


We'll use tabular metrics file logs.csv for these examples:


By default, this command plots the last column of the table (see -y option):

$ dvc plots show logs.csv

Use the -y option to change the column to plot:

$ dvc plots show -y loss logs.csv

Plot file size

Note that by default, all the columns (or fields) are embedded in the plot file metadata. You can select a subset of the columns using the --select option, which can help reduce the file size:

$ ls -lh /Users/usr/src/plots/logs.csv.html
-rw-r--r-- 1 usr grp 2.8K  ... /Users/usr/src/plot/logs.csv.html

$ dvc plots show -y loss --select loss logs.csv

$ ls -lh /Users/usr/src/plots/logs.csv.html
-rw-r--r-- 1 usr grp 1.8K  ... /Users/usr/src/plots/logs.csv.html

Headerless tables

A tabular data file without headers can be plotted with --no-csv-header option. A field or column can be specified with --select by it's numeric position (starting with 0):

$ dvc plots show --no-csv-header --select 2 logs.csv

Vega specification

In many automation scenarios (like CI/CD for ML), it is convenient to have the Vega-Lite specification instead of the entire HTML plot file. For example to generating another image format like PNG or JPEG, or to include differently into a web app. The --no-html option prevents wrapping the plot in HTML. Note that the resulting file is JSON:

$ dvc plots show --select accuracy --no-html logs.csv
    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
    "data": {
        "values": [
        "accuracy": "0.9418667",
        "index": 0,
        "rev": "workspace"
        "accuracy": "0.9763333",
        "index": 1,
        "rev": "workspace"

Example: Hierarchical data (JSON)

We'll use tabular metrics file train.json for this example:

  "train": [
    { "accuracy": 0.96658, "loss": 0.10757 },
    { "accuracy": 0.97641, "loss": 0.07324 },
    { "accuracy": 0.87707, "loss": 0.08136 },
    { "accuracy": 0.87402, "loss": 0.09026 },
    { "accuracy": 0.8795, "loss": 0.0764 },
    { "accuracy": 0.88038, "loss": 0.07608 },
    { "accuracy": 0.89872, "loss": 0.08455 }

DVC identifies and plots JSON objects from the first JSON array found in the file:

$ dvc plots show train.json

Same as with tabular data, use the -y option to change the field to plot:

$ dvc plots show -y accuracy train.json


🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat