creating the plot and the saving the image