Skip to content

'dvc plots show' cannot plot using nested keys #9281

Open
@mattrmd

Description

@mattrmd

I have a metrics.yaml file with the following structure:

- dataset_a:
    metric_1: ...
    metric_2: ...
  dataset_b:
    metric_1: ...
    metric_2: ...
...

I would like to use dvc plots show metrics.yaml -y dataset_a.metric_1 to plot the first metric. However, it seems that DVC is not capable of doing this, as I get the error:

Could not find provided field ('dataset_a.metric_1') in data fields ('dataset_a, dataset_b').

This appears to be a shortcoming in the vega.py file, specifically with the functions _verify_field, _get_xs, and _get_ys. There may be others as well, but I have not looked past these functions yet. It appears that these functions look only at the top level key.

I would like to try extending the functionality of dvc plots show to allow for nested keys. I think that it should be relatively straightforward to use an approach similar to this, but that remains to be seen. I will try to implement this change over the next few weekends, and hopefully my team will be able to use it in production.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A: plotsRelated to the plotsp3-nice-to-haveIt should be done this or next sprint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions