MATLAB: Does the LEGEND get relocated when zooming into a plot in MATLAB 7.1.0 (R14SP3)

figurelegendMATLABplotboxre-locaterelocate

When I execute the following code:
sphere;
legend('sphere');
and use the "View -> Camera Toolbar -> Zoom Camera" menu option to zoom into the sphere, the legend relocates and eventually moves beyond the boundaries of the figure window. I have not observed this behavior in previous versions of MATLAB.

Best Answer

This is an intended change in the behavior of the LEGEND in MATLAB 7.1.0 (R14SP3) incorporated to allow LEGEND to follow the plot box. However, you can explicitly set the 'Location' property of the LEGEND in order not to relocate from its original position as follows:
sphere;
h = legend('sphere');
set(h,'Location','none');
You can also interactively set the 'Location' property of the LEGEND to 'NONE' using the property inspector. Perform the following steps:
1. From the 'View' menu of the figure toolbar, select 'Property Editor '
2. Highlight the LEGEND and select 'Inspector' from its 'Property Editor'
3. Set the 'Location' property to 'none'