plotCorrmatrix | R Documentation |

Having calculated the correlations a heat map indicating the magnitude of the
correlations is produced using `ggplot`

. In this heat map, the darker the red in
a cell then the closer the correlation is to -1, while the deeper the blue in the cell,
then the closer the correlation is to 1. A matrix plot of all pairwise
combinations of the variables can be produced. The matrix plot contains a scatter diagram
for each pair, as well as the value of the correlation coefficient. The argument
`pairs.sets`

can be used to restrict the pairs in the matrix plot to those
combinations within each set.

```
plotCorrmatrix(data, responses, which.plots = c("heatmap","matrixplot"),
title = NULL, labels = NULL, labelSize = 4, pairs.sets = NULL,
show.sig = FALSE, axis.text.size = 20, ggplotFuncs = NULL,
printPlot = TRUE, ...)
```

`data` |
A |

`responses` |
A |

`which.plots` |
A |

`title` |
Title for the plots. |

`labels` |
A |

`labelSize` |
A |

`pairs.sets` |
A |

`show.sig` |
A |

`axis.text.size` |
A |

`ggplotFuncs` |
A |

`printPlot` |
A |

`...` |
allows passing of arguments to other functions; not used at present. |

The correlations and their p-values are producced using `rcorr`

from the `Hmisc`

package. The `heatmap`

is produced using
`ggplot`

and the matrixplot is produced using `GGally`

.

The `heatmap`

plot, if produced, as an object of class "`ggplot`

", which
can be plotted using `print`

; otherwise `NULL`

is returned.

Chris Brien

`rcorr`

, `GGally`

, `ggplot`

.

```
data(exampleData)
longi.dat <- prepImageData(data=raw.dat, smarthouse.lev=1)
longi.dat <- within(longi.dat,
{
Max.Height <- pmax(Max.Dist.Above.Horizon.Line.SV1,
Max.Dist.Above.Horizon.Line.SV2)
Density <- PSA/Max.Height
PSA.SV = (PSA.SV1 + PSA.SV2) / 2
Image.Biomass = PSA.SV * (PSA.TV^0.5)
Centre.Mass <- (Center.Of.Mass.Y.SV1 + Center.Of.Mass.Y.SV2) / 2
Compactness.SV = (Compactness.SV1 + Compactness.SV2) / 2
})
responses <- c("PSA","PSA.SV","PSA.TV", "Image.Biomass", "Max.Height","Centre.Mass",
"Density", "Compactness.TV", "Compactness.SV")
plotCorrmatrix(longi.dat, responses, pairs.sets=list(c(1:4),c(5:7)))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.