Edit on GitHub

plots show

Generate plot from a metrics file.


usage: dvc plots show [-h] [-q | -v] [-t <name_or_path>] [-x <field>]
                      [-y <field>] [--no-header] [--title <text>]
                      [--x-label <text>] [--y-label <text>] [-o <path>]
                      [targets [targets ...]]

positional arguments:
  targets               Metric files to visualize.
                        Shows all plots by default.


This command provides a quick way to visualize metrics such as loss functions, AUC curves, confusion matrices, etc. All plots defined in dvc.yaml are used by default.

Optionally, specific metric file targets to show are accepted. These must be listed in a dvc.yaml file (see the --plots option of dvc run).

The plot style can be customized with plot templates, using the --template option. To learn more about metric file formats and templates please see dvc plots.

Note that the default behavior of this command can be modified per metrics file with dvc plots modify.


  • -o <path>, --out <path> - name of the generated file. By default, the output file name is equal to the input filename with a .html file extension (or .json when using --show-vega).
  • -t <name_or_path>, --template <name_or_path> - plot template to be injected with data. The default template is .dvc/plots/default.json. See more details in dvc plots.
  • -x <field> - field name from which the X axis data comes from. An auto-generated index field is used by default. See Custom templates for more information on this index field. Column names or numbers are expected for tabular metric files.
  • -y <field> - field name from which the Y axis data comes from. The last field found in the targets is used by default. Column names or numbers are expected for tabular metric files.
  • --x-label <text> - X axis label. The X field name is the default.
  • --y-label <text> - Y axis label. The Y field name is the default.
  • --title <text> - plot title.
  • --show-vega - produce a Vega specification file instead of HTML. See dvc plots for more info.
  • --no-header - lets DVC know that CSV or TSV targets do not have a header. A 0-based numeric index can be used to identify each column instead of names.
  • -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.

Example: Hierarchical data

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 (train):

$ dvc plots show train.json

Note that only the last field name (loss) is used for the plot by default.

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

$ dvc plots show -y accuracy train.json

Example: Tabular data

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 logs.csv -y loss

Headerless tables

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

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

Example: Vega specification file

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

$ dvc plots show --show-vega logs.csv -y accuracy
    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
    "data": {
        "values": [
        "accuracy": "0.9418667",

๐Ÿ› Found an issue? Let us know! Or fix it:

Edit on GitHub

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

Discord Chat