added a legend to both graphs