Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Plot variable correlations

`corrplot(X)`

`corrplot(X,Name,Value)`

`R = corrplot(___)`

```
[R,PValue]
= corrplot(___)
```

`corrplot(ax,___)`

```
[R,PValue,H]
= corrplot(___)
```

`corrplot(`

creates a matrix of
plots showing correlations among pairs of variables in `X`

)`X`

.
Histograms of the variables appear along the matrix diagonal; scatter plots of
variable pairs appear in the off diagonal. The slopes of the least-squares
reference lines in the scatter plots are equal to the displayed correlation
coefficients.

`corrplot(`

uses additional options specified by one or more name-value pair arguments. For
example, `X`

,`Name,Value`

)`corrplot(X,'type','Spearman','testR','on')`

computes
Spearman’s rank correlation coefficient and tests for significant correlation
coefficients.

returns the correlation matrix of `R`

= corrplot(___)`X`

displayed in the plots
using any of the input argument combinations in the previous syntaxes.

`corrplot(`

plots on the axes specified by `ax`

,___)`ax`

instead
of the current axes (`gca`

). `ax`

can precede any of the input
argument combinations in the previous syntaxes.

The option

`'rows','pairwise'`

, which is the default, can return a correlation matrix that is not positive definite. The`'complete'`

option always returns a positive-definite matrix, but in general the estimates are based on fewer observations.Use

`gname`

to identify points in the plots.

The software computes:

*p*-values for Pearson’s correlation by transforming the correlation to create a*t*-statistic with`numObs`

– 2 degrees of freedom. The transformation is exact when`X`

is normal.*p*-values for Kendall’s and Spearman’s rank correlations using either the exact permutation distributions (for small sample sizes) or large-sample approximations.*p*-values for two-tailed tests by doubling the more significant of the two one-tailed*p*-values.

`collintest`

| `corr`

| `gname`