Skip to content

Instantly share code, notes, and snippets.

@jcpsantiago
Last active September 6, 2020 14:21
Show Gist options
  • Save jcpsantiago/9377f1040d11a92f06c6ee7f18423ee4 to your computer and use it in GitHub Desktop.
Save jcpsantiago/9377f1040d11a92f06c6ee7f18423ee4 to your computer and use it in GitHub Desktop.
Print DVC plots and metrics in the terminal
# Usage: plotit <target (required)> <x> <y> <width> <height>
function plotit -d="Prints DVC plots on the terminal" -a target x y width height
if test -z "$target"
echo Please provide a target csv file.
return 1
end
# set `-x` or `-y` if they are provided
set x_or $x ""
set y_or $y ""
if test $x_or[1] != ""
set x_or -x $x_or
end
if test $y_or[1] != ""
set y_or -y $y_or
end
# set fallback width and height
test -z "$width"; and set width 500
test -z "$height"; and set height 500
set dvcplotdiff dvc plots diff $x_or $y_or --show-vega --targets $target
eval $dvcplotdiff | \
jq ". += {\"width\": $width, \"height\": $height}" | \
vl2vg | \
vg2svg | \
kitty +kitten icat --align left && \
dvc metrics diff
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment