Move graph plotting to a separate library