A "bodeplot" creates more than one axes and when calling "legend" without specifying the parent axes, MATLAB takes the last active axes which might be an invisible one leading to undesired behavior. Overall it is the best to specify the axes as input to which the legend refers, e.g.
legend(findall(gcf,'type','axes','visible','on'),'test','Location','southwest');
This will keep the legend visible when resizing the figure.