No products are associated with this question.
I cannot reproduce this with:
plot(1:10) legend('plot') line([5 5],[0 10])
So I want to ask what your code looks like. If you only have the one plot axes and the legend (no uicontrols or other figure children), then this will bring the legend back:
If you have other figure children, the idea is the same, you will just have to be more careful about the rearrangement.