If you are using the kitty terminal, you can get nice graphs at the toplevel:
dot(Prg) :-
Cmd='dot -Tpng | kitty +kitten icat --stdin yes',
setup_call_cleanup(
open(pipe(Cmd),write,Stream,[]),
write(Stream,Prg),
close(Stream)
).
plot(Plot) :-
format(string(Cmd),"
cat <<EOF | gnuplot
set terminal pngcairo enhanced font 'Fira Sans,10'
set autoscale
set samples 1000
set output '|kitty +kitten icat --stdin yes'
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb \"#fdf6e3\" behind
plot ~w
set output '/dev/null'
EOF",[Plot]),
shell(Cmd).
How it looks:
EDIT: you need to have graphviz
and gnuplot
installed to make it work.