MATLAB Examples

# scaleax documentation

This function scales data and axis limits after data have been plotted. This may be helpful if you've plotted several data sets then decided, "the y axis labels should be in nanometers instead of meters."

## Syntax

```scaleax(ScaleFactor)
scaleax(axis_h,ScaleFactor)
scaleax('axis',ScaleFactor)
scaleax(axis_h,'axis',ScaleFactor)```

## Description

scaleax(ScaleFactor) scales the x, y, and z data of the current axes by a scalar ScaleFactor value.

scaleax(axis_h,ScaleFactor) specifies an axis handle on which to perform scaleax. If no axis handle is declared, axis_h = gca.

scaleax('axis',ScaleFactor) specifies which data to scale, where 'axis' can be 'x', 'y', 'z', or 'all'. If 'axis' is not specified, 'all' is assumed.

scaleax(axis_h,'axis',ScaleFactor) scales 'axis' data on axis_h by ScaleFactor.

## Example

You drove a thousand kilometers, logging some measurement every kilometer along the way. Your measurement device records a tiny (order of tens of nanovolt) signals in units of volts.

```x = 0:1000:1000000; % meters traveled y = 3e-8*(sin(x/1e5)+.1*rand(size(x))); % measured volts plot(x,y) xlabel('distance traveled (m)') ylabel('measured potential (V)') ```

Don't make your audience mentally convert nine-times-ten-to-the-fifth meters to kilometers or two-times-ten-to-the-minus-eight volts into nanovolts. Scale those axes!

```scaleax('x',1/1000) xlabel('distance traveled (km)') scaleax('y',1e9) ylabel('measured potential (nV)') ```

## Author Info

This function was written by Chad A. Greene of the University of Texas Institute for Geophysics (UTIG) on November 7, 2014.