MATLAB Examples

# isax documentation

Determine whether inputs are axis handles.

## Syntax & Description

isax(H) returns an array whose elements are 1 where the elements of H are valid axis handles, and 0 where they are not.

## Examples

First we'll open a figure and plot four axes:

```figure for k = 1:4 subplot(2,2,k) pcolor(peaks) shading interp cb(k) = colorbar; ax(k) = gca; end ```

The figure numer is 1. Is 1 and axis?

```isax(1) ```
```ans = 0 ```

Similarly,

```isax(gcf) ```
```ans = 0 ```

Of course not. The current figure, Figure 1, is a figure, not a set of axes. Does gca describe a set of axes?

```isax(gca) ```
```ans = 1 ```

What about all the values in that ax array we built in the loop?

```isax(ax) ```
```ans = 1 1 1 1 ```

They're all axes, alright. And if ax is a column vector, the output will be a column as well:

```isax(ax') ```
```ans = 1 1 1 1 ```

You may also enter a mix of strings and numeric values:

```isax(ax(1),'potatoes',gca,'matlab') ```
```ans = 1 0 1 0 ```

In pre-R2014b versions of Matlab, colorbars are categorized as axes. In the new graphics system, colorbars are their own thing. So if the default color scheme in the pcolor plots above didn't already give it away, which version of Matlab am I using?

```isax(cb) ```
```ans = 1 1 1 1 ```

## Author Info

This function and supporting documentation were written by Chad A. Greene of the University of Texas at Austin's Institute for Geophysics (UTIG), December 2014.