Code to generate graph and associated png file.