# contourc

## Purpose

Contour plot computation.

## Synopsis

````C = contourc(Z)`
`C = contourc(Z,n)`
`C = contourc(Z,v)`
`C = contourc(x,y,Z)`
`C = contourc(x,y,Z,n)`
`C = contourc(x,y,Z,v)`
```

## Description

`contourc` calculates the contour matrix `C` used by the M-file `contour` to draw actual contour plots.

`C = contourc(Z)` computes the contour matrix for a contour plot of matrix `Z`. The contours are level lines in the units of `Z`. The number of contour lines and their corresponding values are chosen automatically by `contourc`.

`C = contourc(Z,n)` computes contours of matrix `Z` with `n` contour levels.

`C = contourc(Z,v)` computes contours of `Z` with contour levels at the values specified in vector `v`.

`C = contourc(x,y,Z)`, `C` `=` `contourc(x,y,Z,n)`, and `C = contourc(x,y,Z,v)` compute contours of `Z` and use the data in vectors `x` and `y` to control the axis scaling on the x- and y-axes. The elements of `x` and `y` are equally spaced.

The contour matrix `C` is a two-row matrix of contour lines. Each contiguous drawing segment contains the value of the contour, the number of `(x,y)` drawing pairs, and the pairs themselves. The segments are appended end-to-end,

````C = [level1  x1  x2  x3...level2  x2  x2  x3...;`
pairs1  y1  y2  y3...pairs2  y2  y2  y3...]
```

## Limitations

`contourc` assumes that vectors `x` and `y` are monotonically increasing. If `x` and `y` are irregularly spaced, the contours are simply stretched apart, which is not the same as contouring the irregularly spaced data.

````contour`, `contour3`