legend(...,'Location', 'location')
allows you to either specify the 'location' as one of a huge number of pre-defined positions e.g 'NorthWest', 'NorthWestOutside' or as a standard 1-by-4 position vector for precise manual positioning.
The pre-defined locations are included in a list on the help page for 'legend'