Code covered by the BSD License  

Highlights from
SETAXES

5.0

5.0 | 4 ratings Rate this file 3 Downloads (last 30 days) File Size: 6.32 KB File ID: #18607
image thumbnail

SETAXES

by Mukhtar Ullah

 

04 Feb 2008 (Updated 19 Oct 2010)

creates handles of nested functions for fixing problems with MATLAB figures.

| Watch this File

File Information
Description

This subsmission was inspired by the blog:
http://blogs.mathworks.com/loren/2007/12/11/making-pretty-graphs/

SETAXES fixes common problems with MATLAB figures.
  SETAXES(AX, ...) applies to the axes AX which, when not supplied, defaults to the current axes.
   SETAXES('xoffset') [2-D view only] adjusts the axes position in the horizontal direction to make up for any clipped (left or right) part of the axes based on some default settings.

   SETAXES('yoffset') [2-D view only] adjusts the axes position in the vertical direction to make up for any clipped (lower or upper) part of the axes based on some default settings.

   SETAXES('axesmoveresize', [L B R T]) adds the array [L B -R -T] to the 'OuterPosition' property of the axes.

   SETAXES('xtick2text', OFFSET) [2-D view only] replaces the tick labels on the X-Axis by text objects where OFFSET is the factor of the axis height used as the vertical margin from the X-Axis.
      When not supplied, OFFSET defaults to 0.03.

   SETAXES('xtick2text',..., PROP1, VALUE1, PROP2, VALUE2, ...)
      sets the values of the specified properties of the text objects.
   
   HT = SETAXES('xtick2text',...) returns in HT the handles of the text objects.

   SETAXES('ytick2text', OFFSET) [2-D view only] replaces the tick labels on the Y-Axis by text objects where OFFSET is the factor of the axis width used as the horizontal margin from the Y-Axis.
      When not supplied, OFFSET defaults to 0.02.

   SETAXES('ytick2text',..., PROP1, VALUE1, PROP2, VALUE2, ...)
      sets the values of the specified properties of the text objects.
   
   HT = SETAXES('ytick2text',...) returns in HT the handles of the text objects.

   SETAXES('xlabelcorner') [2-D view only] places the XLABEL in an appropriate corner. The most common corner is the right-bottom when the X-Axis is to the bottom and the ticks are increasing from left to right. The corner changes accordingly for other combinations of axes properties.

   SETAXES('xlabelcorner', PROP1, VALUE1, PROP2, VALUE2, ...)
   sets the values of the specified properties of the XLabel object.

   SETAXES('ylabelcorner') [2-D view only] places the YLABEL in an appropriate corner. The most common corner is the top-left when the Y-Axis is to the left and the ticks are increasing upward. The corner changes accordingly for other combinations of axes properties.

   SETAXES('ylabelcorner', PROP1, VALUE1, PROP2, VALUE2, ...)
   sets the values of the specified properties of the YLabel object.

   SETAXES('axesarrows') [2-D view only] adds arrow annotation objects to X- and Y-Axis. The default 'HeadLength' and 'HeadWidth' are both 5. Line width and Color are inherited from the the corresponfing axis line.

   SETAXES('axesarrows','xx') adds arrow annotation objects to X-Axis only.
   SETAXES('axesarrows','yy') adds arrow annotation objects to Y-Axis only.
   
   SETAXES('axesarrows',..., PROP1, VALUE1, PROP2, VALUE2, ...)
   sets the values of the specified properties of the arrow objects.

   HA = SETAXES('axesarrows',...) returns in HA the handles of the arrow objects.

   Note that since SETAXES('axesarrows',...) changes the axes position property, any annotation objects should be added after SETAXES('axesarrows',...).

=====================================================

%Detail for each function and a comprehensive EXAMPLE is included in help.
%-----------------------------------------------------------------------

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File  
Everyone's Tags
annotation(2), axis, clipped labels, customization, graphics, latex(2), plot, publication quality(2), small figures
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
16 Nov 2012 Alessandro

Great code!
There is a small problem: if I export in eps the arrows are not rendered correctly.

Any idea?

08 Mar 2012 Yuri K

Great function! Switched to it from rotateticklabel.

18 Jun 2008 tom mezger

cool. this is one of the best files i have ever found.

19 May 2008 Christopher Barrington-Leigh

Wow, this is a labour of love and is nearly magical for me. For months I have been struggling with the infuriating difficulty of exporting small figures with LaTeX-rendered xlabels.
The automatic mode of your code improves the situation for me. I need to use the detailed version to get it right, and that means fiddling around by hand for each plot. Being reduced to that again is of course, a great shame and a significant failure for Matlab, but at least I know how now. To Mukhtar (and the blog which inspired him) -- THANK YOU!!!

Updates
05 Feb 2008

Corrected typos in help both in file and on file exchange summary.

05 Feb 2008

Corrected description.

06 Feb 2008

Included inspiration.

18 Sep 2008

Fixed a bug thanks to Thorsten Bartels-Rausch. The functions xtick2text and ytick2text were not working as expected in case of logarithmic (XScale,YScale) and/or reverse (XDir,YDIR).

20 Oct 2008

Dependency on a missing file removed

19 Oct 2010

A new simplified syntax to avoid function handles. Removed features that did not work properly.

Contact us