# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# compass

Plot arrows emanating from origin

## Syntax

`compass(U,V)compass(Z)compass(...,LineSpec)compass(axes_handle,...)h = compass(...)`

## Description

A compass graph displays the vectors with components `(U,V)` as arrows emanating from the origin. `U`, `V`, and `Z` are in Cartesian coordinates and plotted on a circular grid.

`compass(U,V)` displays a compass graph having n arrows, where n is the number of elements in `U` or `V`. The location of the base of each arrow is the origin. The location of the tip of each arrow is a point relative to the base and determined by `[U(i)`,`V(i)]`.

`compass(Z)` displays a compass graph having n arrows, where n is the number of elements in `Z`. The location of the base of each arrow is the origin. The location of the tip of each arrow is relative to the base as determined by the real and imaginary components of `Z`. This syntax is equivalent to `compass(real(Z),imag(Z))`.

`compass(...,LineSpec)` draws a compass graph using the line type, marker symbol, and color specified by `LineSpec`.

`compass(axes_handle,...)` plots into the axes with the handle `axes_handle` instead of into the current axes (`gca`).

`h = compass(...)` returns handles to line objects.

## Examples

collapse all

Create a compass graph of the eigenvalues of a random matrix.

```rng(0,'twister') % initialize random number generator M = randn(20,20); Z = eig(M); figure compass(Z) ```

## See Also

#### Introduced before R2006a

Was this topic helpful?

Watch now