AXIS_PRUNELABELS takes a figure with a grid of subplots (created using either SUBPLOT or custom AXES commands), and (a) forces all the subplots to have the same axis limits, and (b) turns off axis labels on all the "interior" subplots, thereby reducing the visual clutter.
By default, it operates on both the x- and y-axes, and on the current figure.
This function works with MATLAB 6.5 (R13). Additionally, if LINKAXES is available (MATLAB 7.0), then all the subplot axes linked together.
I use and like this piece of code quite a bit.
I did however just notice that if you have changed the location of the axis, this won't prune the correct labels. For instance, I had set my x-axis to 'top' on a 3 X 2 subplot matrix and axis_prunelabels left the labels on the bottom 2 sub-plots.
Probably a simple fix the author might consider...
Worked excellent for my needs, features a good help and comments, and has error checking. Hence, I rate it excellent.
One thing: I made various subplots and applied axis_prunelabels to the y-axes.
When each subplot features an axis label on the y-axis (e.g. ylabel('depth')), than these labels won't be removed.
I wrote this function for R13, which didn't support logical operators with FINDOBJ. Also, there may be other kinds of special axes other than legends.
A general solution would be to have a optional parameter where the user can directly specify the list of axes handles. Feel free to extend this function in this manner and submit as a new FileExchange posting.
This is useful,
but it does not handle legends properly.
Consider replacing the line 45 by the following to improve it.
% find the axes in the figure