SETAXES

creates handles of nested functions for fixing problems with MATLAB figures.
3.7K Downloads
Updated 19 Oct 2010

View License

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

Cite As

Mukhtar Ullah (2024). SETAXES (https://www.mathworks.com/matlabcentral/fileexchange/18607-setaxes), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Labels and Annotations in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

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

1.0.0.0

Dependency on a missing file removed