Show axis border when legend is outside plot

framestyle=:box gives you borders around the plot, is this what you need? AFAIK the position of the legend has nothing to do with that.