# Plots multiple data sources in yaml doesn't work

**URL:** <https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470>\
**Category:** Questions\
**Created:** [January 24, 2023, 10:19am UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470 "2023-01-24T10:19:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mouadAqsone](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dvc.org/mouadaqsone/32/207_2.png) [@mouadAqsone](https://discuss.dvc.org/u/mouadAqsone)\
**Post date:** [January 24, 2023, 10:19am UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470/1 "2023-01-24T10:19:45Z")

</div>

Hello I’m following a tutorial in the docs and while trying to make plots work I’ve encountered this problem while writing my dvc yaml file.  
Im pretty sure the syntax is correct and the dvc version is “DVC version: 2.42.0 (pip)”

![image](https://canada1.discourse-cdn.com/flex035/uploads/dataversioncontrol/original/1X/877ac1badc4f4c7e57686f072182404fdbdd1037.png)

I also tried this writing:  
plots:

```auto
-ROC:
        # Configure template and axes.
        x: fpr
        y:
          eval/live/plots/sklearn/roc/train.json: tpr
          eval/live/plots/sklearn/roc/test.json: tpr

```

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [January 24, 2023, 12:37pm UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470/2 "2023-01-24T12:37:41Z")

</div>

Could you elaborate on what error you are getting and from where?

---

<div class="post-metadata">

**Author:** ![dberenbaum](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dberenbaum](https://discuss.dvc.org/u/dberenbaum)\
**Post date:** [January 24, 2023, 3:12pm UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470/3 "2023-01-24T15:12:17Z")

</div>

In the first example, plot outputs inside of stages don’t support multiple data sources. They must be “top-level” plots that are separate from your stage outputs. The dvc.yaml should look like:

```yaml
plots:
  - ROC:
      x: fpr
      y:
        eval/live/plots/sklearn/roc/train.json: tpr
        eval/live/plots/sklearn/roc/test.json: tpr
stages:
...

```

@mouadAqsone Please don’t hesitate to share your feedback on how we can better clarify this.

---

<div class="post-metadata">

**Author:** ![etheredge](https://avatars.discourse-cdn.com/v4/letter/e/22d042/32.png) [@etheredge](https://discuss.dvc.org/u/etheredge)\
**Post date:** [February 29, 2024, 12:36pm UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470/4 "2024-02-29T12:36:04Z")

</div>

@dberenbaum Thanks for the response. For me, placing plots at top level does not seem to fix the issue with multiple data sources in 3.48.0.

```auto
metrics:
- models/training_summary/metrics.json
plots:
  - step vs loss:
      template: smooth
      x: step
      y:
        models/training_summary/plots/metrics/train/step/loss.tsv: loss
        models/training_summary/plots/metrics/val/step/loss.tsv: loss
      title: Step Loss
stages:
...

```

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/dataversioncontrol/original/1X/7aa633834279b8b02e48457c5fd3e1978a279f79.png)

---

<div class="post-metadata">

**Author:** ![dberenbaum](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dberenbaum](https://discuss.dvc.org/u/dberenbaum)\
**Post date:** [February 29, 2024, 2:28pm UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470/5 "2024-02-29T14:28:21Z")

</div>

Can you post a fully reproducible example? Copying your dvc.yaml exactly, I’m unable to reproduce the issue:

![plot](https://canada1.discourse-cdn.com/flex035/uploads/dataversioncontrol/original/1X/6e8e681a29f04ed4369c4fe3cade7fbd680c4898.png)

---

<div class="post-metadata">

**Author:** ![etheredge](https://avatars.discourse-cdn.com/v4/letter/e/22d042/32.png) [@etheredge](https://discuss.dvc.org/u/etheredge)\
**Post date:** [March 11, 2024, 11:00am UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470/6 "2024-03-11T11:00:20Z")

</div>

Hi @dberenbaum, thanks for your reply. Here is the dvc.yaml:

```auto
metrics:
- training_summary/metrics.json
plots:
- step vs loss:
    template: smooth
    x: step
    y:
      training_summary/plots/metrics/train/step/loss.tsv: loss
      training_summary/plots/metrics/val/step/loss.tsv: loss
    title: Step val Loss
stages:
  train:
    cmd: python proj/train.py 
      --train_paths ${train.train_paths} 
      --val_paths ${train.val_paths} 
      --model_dir ${train.trained_model_dir}
      --model_file_name ${train.model_file_name}
    outs:
    - models
    - training_summary

```

dvc 3.48.0  
dvc-data 3.13.0  
dvc-http 2.32.0  
dvc-objects 5.1.0  
dvc-render 1.0.1  
dvc-studio-client 0.20.0  
dvc-task 0.3.0  
dvclive 3.44.0

Do these versions match yours?

---

<div class="post-metadata">

**Author:** ![dberenbaum](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dberenbaum](https://discuss.dvc.org/u/dberenbaum)\
**Post date:** [March 11, 2024, 1:44pm UTC](https://discuss.dvc.org/t/plots-multiple-data-sources-in-yaml-doesnt-work/1470/7 "2024-03-11T13:44:04Z")

</div>

I’m still unable to reproduce it. Could you share your code as well? Even better would be if you can narrow it down to a simple reproducible script.
