General code cleanup: less dead code, more comments, more straightforward output generation.
Bad indentation is bad.
Decompose the gnuplot render command invoked using system() to prevent clever security exploits using special shell syntax in interpolated variables.
Use ruby-graphviz instead of graph gem