4.33333

4.3 | 3 ratings Rate this file 110 downloads (last 30 days) File Size: 2.27 KB File ID: #16115

Axis_Prunelabels -- clean up redundant axis labels

by Gautam Vallabha

 

27 Aug 2007 (Updated 28 Aug 2007)

Code covered by BSD License  

Minimizes redundant axis labels in a grid of subplots

Editor's Notes:

This was a File Exchange Pick of the Week

Download Now | Watch this File

File Information
Description

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.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
12 Sep 2007 Mathias Ortner

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
h=findobj(figHandle,'type','axes','-not','Tag','legend');

23 Sep 2007 Gautam Vallabha

Regarding using
  findobj(...,'-not','tag','legend)
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.

03 Oct 2007 Wolfgang Schwanghart

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.

30 May 2008 Andrew Stevens

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...

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
axis label Gautam Vallabha 22 Oct 2008 14:44:27
subplot Gautam Vallabha 22 Oct 2008 14:44:27
minimize Gautam Vallabha 22 Oct 2008 14:44:27
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com