loading...
Cover image for Print DVC plots and metrics directly in the terminal

Print DVC plots and metrics directly in the terminal

jcpsantiago profile image João Santiago ・1 min read

DVC has changed the way I handle Machine Learning projects for the better. The dvc plots diff command is a great way to see the effect of rounds of experimentation.

If you use the kitty terminal, it's possible to print DVC plots directly in the terminal without opening an external program/browser. I wrote a function for the fish shell to simplify this process.

Alt Text

Assuming you are using fish as your shell, save this code as ~/.config/fish/functions/plotit.fish

Then refresh your shell with source ~/.config/fish/functions/plotit.fish. Finally, install jq and vega-cli, if you don't have them in your system yet.

Example usage when inside a DVC-enabled project:

  • plotit pr_curve.csv -> prints diff plot with width x height of 500px x 500px and x set to row-index and y to the second column of the csv
  • plotit pr_curve.csv recall precision -> same as above but selects the columns for x and y
  • plotit pr_curve.csv recall precision 800 800 -> with custom width and height in pixels

Enjoy!

Discussion

pic
Editor guide