Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows - dvc plots show incorrect directory structure for manual plot images. #7812

Closed
dfossl opened this issue May 25, 2022 · 2 comments
Closed
Labels
A: plots Related to the plots bug Did we break something?

Comments

@dfossl
Copy link

dfossl commented May 25, 2022

Bug Report

dvc plots show: img src directory incorrectly formatted for saved plot images (Windows)

Description

On windows, when using a saved .png of a matplotlip plot for visualization with 'dvc plots show' the default img src is "dvc_plots\static\workspace_.png"
When it should be "static\workspace_.png"

Reproduce

mkdir example
cd example
git init
dvc init

With this script as evaluate.py

import os

from dvclive import Live
from matplotlib import pyplot as plt

live = Live("evaluation")

y_true = [0, 0, 1, 1]
y_pred = [0.2, 0.5, 0.3, 0.8]
live.log_plot("roc", y_true, y_pred)

fig, axes = plt.subplots(dpi=100)
fig.subplots_adjust(bottom=0.2, top=0.95)
plt.scatter([1,2,3], [4,5,6])
fig.savefig(os.path.join("evaluation", "importance.png"))

Running this command (Powershell 7):

dvc run -n evaluate `
-d .\evaluate.py `
--plots-no-cache .\evaluation\plots\roc.json `
--plots evaluation\importance.png `
python .\evaluate.py

Followed by:

dvc plots show

Results in directory:

dvc_plots
    |-index.html
    |-static\
        |-workspace_evaluation_importance.png

Where the img src is:

 <img src="dvc_plots\static\workspace_evaluation_importance.png">

html page:
image

Expected

Should be:

 <img src="static\workspace_evaluation_importance.png">

html page:
image

Environment information

Output of dvc doctor:

$ dvc doctor
DVC version: 2.10.2 (pip)
---------------------------------
Platform: Python 3.10.4 on Windows-10-10.0.17763-SP0
Supports:
        webhdfs (fsspec = 2022.5.0),
        http (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
        https (aiohttp = 3.8.1, aiohttp-retry = 2.4.6)
Cache types: hardlink
Cache directory: NTFS on C:\
Caches: local
Remotes: None
Workspace directory: NTFS on C:\
Repo: dvc, git
@dfossl dfossl changed the title Windows - dvc show plots incorrect directory structure for manual plot images. Windows - dvc plots show incorrect directory structure for manual plot images. May 25, 2022
@pared
Copy link
Contributor

pared commented May 26, 2022

Good catch! It should be partially fixed by:
#7664

We need to wait for a next release for that.

Proper fix will come after we merge and release iterative/dvc-render#39

@pared pared added bug Did we break something? A: plots Related to the plots labels May 26, 2022
@pared
Copy link
Contributor

pared commented May 26, 2022

Leaving it open till we finish all the needed changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: plots Related to the plots bug Did we break something?
Projects
None yet
Development

No branches or pull requests

2 participants