View source: R/procrustes.var.plot.R
procrustes.var.plot | R Documentation |
Modification of the plotRefToTarget
function to allow to display landmark variation on Procrustes
procrustes.var.plot(
M1,
M2,
col = list("grey", "black"),
col.val,
magnitude = 1,
labels = FALSE,
axes = FALSE,
pt.size = 1,
gridPar,
col.range,
lwd = 2,
...
)
M1 |
Matrix of landmark coordinates for the first (reference) specimen |
M2 |
Matrix of landmark coordinates for the second (target) specimen |
col |
Either a single color value ( |
col.val |
Optional, if |
magnitude |
The magnitude of difference between the two shapes ( |
labels |
Logical, whether to plot the landmark labels ( |
axes |
Logical, whether to plot the plot axes ( |
pt.size |
The size of the points ( |
gridPar |
Optional, a named list of grid parameters generated by |
col.range |
Optional, two |
lwd |
Optional, the line width (by default, |
... |
Additional parameters to |
col
arguments are passed to plot
or plot3d
as follows:
if col is a single value or a single vector, it passes it to both points and colors arguments;
if col is a single function, it applies it to both points and colors arguments based on the argument col.val
;
if col is a list of two values, vectors or functions, it will apply the first element to the points and the second to the vectors the same way as described above;
If col.val
is provided the function samples colors according the the col
argument (see above) using the range of the col.val
vector.
You can change this range to some absolute values by using the col.range
option: the colors are then sampled along the col.range
range for each col.val
.
Thomas Guillerme - original function by Dean Adams, Emma Sherratt & Michael Collyer.
variation.range
## Loading the geomorph dataset
require(geomorph)
data(plethodon)
## Performing the Procrustes superimposition
proc_super <- gpagen(plethodon$land, print.progress = FALSE)
## Getting the range of variation
variation <- variation.range(proc_super, return.ID = TRUE)
## Selecting the coordinates and the variation vector
M1 <- proc_super$coords[, , variation$min.max[1]]
M2 <- proc_super$coords[, , variation$min.max[2]]
var_val <- variation$range[, 1]
## Plot the variation
procrustes.var.plot(M1, M2)
## A colourful plot
procrustes.var.plot(M1, M2, col = list(grDevices::rainbow, "pink"), col.val = var_val,
pt.size = 2.5)
## A series of heat plots with different options
par(mfrow = c(3,1), mar = c(0,0,2,0))
procrustes.var.plot(M1, M2, main = "Uncolored variation")
procrustes.var.plot(M1, M2, col = grDevices::heat.colors, col.val = var_val,
main = "Relative colours")
procrustes.var.plot(M1, M2, col = grDevices::heat.colors, col.val = var_val,
col.range = c(0, 0.2), main = "Absolute colours (range = c(0, 0.2))")
## Not run:
## Loading the scallops 3D data from geomorph
require(geomorph)
data(scallops)
## Procrustes superimposition
procrustes <- gpagen(scallops$coorddata)
## Getting the range of variation
variation <- variation.range(procrustes, return.ID = TRUE)
## Selecting the coordinates and the variation vector
M1 <- procrustes$coords[, , variation$min.max[1]]
M2 <- procrustes$coords[, , variation$min.max[2]]
var_val <- variation$range[, 1]
## Plot the variation in 3D
procrustes.var.plot(M1, M2, col.val = var_val, col = list(grDevices::heat.colors, "grey"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.