Updated script to generate plot