add legend to plot

Here are the edits required to add the legend.