MATLAB: How to tell the difference between the legend and the plot axes from the results of a findobj(gcf,’type’,’axes’) command in MATLAB 7.5 ( R2007b )
MATLAB
When I query the figure for the axes , I get two two handles, both of which have 'Type' 'Axes'.
line
legend('myLegend');
a = findobj(gcf,'type','axes');
Best Answer
The 'Tag' Property can be used to differentiate between an axes and a legend.
This enhancement has been incorporated in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
The documentation on the 'boxon' and 'boxoff' options for the LEGEND function in MATLAB may be somewhat unclear. Here is a more complete description of these options:
legend('boxoff'), legend(axes_handle,'boxoff') removes the box from the legend in the current axes or the axes specified by axes_handle and makes the legend background transparent.
legend('boxon'), legend(axes_handle,'boxon') adds a box with an opaque background to the legend in the current axes or the axes specified by axes_handle.
Best Answer