added legend to the graph