Made the legend draw below or above the plot area in cases where it is placed in a corner and the layout is horizontal.
Test case for the previous