added code to generate the plot