Problem with top-level plot definitions

Hey!

I am currently having problems with a top-level plot definition.
My dvc.yaml file contains a stage producing
output_data/plot_metrics/metrics_plot_dict.json as output (also defined as outs in dvc.yaml)

I am trying to define a plot like this in dvc.yaml

plots:
  acceptance_rate_histogram:
    template: plot_templates/histogram_template.json
    x: 
      output_data/plot_metrics/metrics_plot_dict.json: acceptance_rate
    x_label: Acceptance_Rate
    title: Histogram

But with dvc plots show I receive :

2022-09-14 12:37:13,109 WARNING: 'acceptance_rate_histogram' was not found in current workspace.
2022-09-14 12:37:13,113 DEBUG: 'acceptance_rate_histogram' - file type error
Only JSON, YAML, CSV and TSV formats are supported.
------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/miniconda3/envs/pymc_stable/lib/python3.10/site-packages/dvc/utils/__init__.py", line 410, in wrapper
    vals = func(*args, **kwargs)
  File "/home/tim/miniconda3/envs/pymc_stable/lib/python3.10/site-packages/dvc/repo/plots/__init__.py", line 548, in parse
    raise PlotMetricTypeError(path)
dvc.repo.plots.PlotMetricTypeError: 'acceptance_rate_histogram' - file type error
Only JSON, YAML, CSV and TSV formats are supported.
------------------------------------------------------------
DVC failed to load some plots for following revisions: 'workspace'.
file:///home/tim/Workspaces/pystoms/pipelines/pipe_A/dvc_plots/index.html
2022-09-14 12:37:13,120 DEBUG: Analytics is enabled.
2022-09-14 12:37:13,190 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmpaooxh7mo']'
2022-09-14 12:37:13,191 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmpaooxh7mo']'

It seems as if dvc tries to find a file named acceptance_rate_histogram, but this string is supposed to be an id. If I exchange the id for the file’s path, it works.

My dvc version: 2.25.0
My python version: 3.10.6
My OS: Ubuntu 22.04

Thank you very much for any help!

Hey @TimOliverMaier!
The reason for that is that currently DVC tries to get the file by looking at y. In other case it will try to treat id as a file - hence your problem, we need to allow for locating the x too.
Here is relevant issue:

1 Like

Hi @Paffciu !
Thank you very much for your super quick answer! Knowing that, I will be able to make myself a quick-fix.

Cheers!

1 Like