animdefo: animdefo

Description Usage Arguments Author(s) Examples

Description

This function save images of 2D the deformations of a reference 2d shape relatively to sequence(s) of shapes contained in "seqlist" argument; this can store from 1 to 4 sequences of shapes. Plots are saved in the working directory and can be combined in animated GIF using external softwares. By default the titles of each plot are "PC1", "PC2", "PC3", "PC4" but any title can be set (see examples). Heatmap is computed by default.

Usage

1
2
3
4
5
6
7
8
animdefo(mshape, seqlist, suffix = "anim", czlim = T, czlimw = F,
  linkss = NULL, linkst = NULL, colss = 1, colst = 2, lwds = 2,
  lwdt = 2, cexs = 0, cext = 0, displ = F, axtit = NULL, mag = 1,
  heat = T, mar = c(0, 0, 0.3, 0), mai = c(0, 0, 0.3, 0), oma = c(0, 0,
  3, 0), colors = c("blue4", "cyan2", "yellow", "red4"), alpha = 1,
  magrange = 1, exts = NULL, PB = NA, PA = NA, S = NA, SB = NA,
  H = NA, V = 3, a = NULL, q = NULL, Y = FALSE, j = FALSE,
  D = FALSE, St = Inf, Q = TRUE, constr = T, pholes = NA)

Arguments

mshape

matrix: a kx2 matrix which is the reference matrix whose deformation is evaluated relatively to the shapes presented in "seqlist" argument. If links are provided the heatmap is computed in the constrained Delaunay triangulation defined by the links. Otherwise the Delaunay triangulation is not constrained.

seqlist

list: a list with 1 to 4 elements each containing a sequence of shapes that are contrasted with the reference shape. If more than one sequence is provided the sequences must contain the same number of shapes.

suffix

characther: suffix name to attch to the saved .png files (default = "anim")

czlim

logical: if more than one sequence is present in "seqlist" argument the zlim of all plot is common by default.

czlimw

logical: if TRUE and If more than one sequence is present in "seqlist" argument the zlim of all plot is different and common only within any specific sequence.

linkss

numeric: links for source configuration; if heat=T these (as well as "linkst" argument) must identify a closed contour in order to allow the Delaunay triangulation constrained within the external border.

linkst

numeric: links for target configuration

colss

numeric: landmarks color for source

colst

numeric: landmarks color for target

lwds

numeric: links width for source

lwdt

numeric: links width for target

cexs

numeric: cex parameter for landmarks of source

cext

numeric: cex parameter for landmarks of target

displ

logical: if TRUE displacement vectors are displayed

axtit

character: if NULL it uses as defaults: c("PC1+", "PC1-","PC2+", "PC2-","PC3+", "PC3-").

mag

numeric: magnification parameter for the illustrated deformation

heat

logical: if TRUE the heatmap is used. Heatmap is computed by calculating the log(determinant) of Jacobian matrix calculated using the first derivative of Thin Plate Spline function.

mar

numeric vector: "mar" argument in par()

mai

numeric vector: "mai" argument in par()

oma

numeric vector: "oma" argument in par()

colors

character: color palette for heatmap

alpha

numeric: transparency parameter for heatmpa color

magrange

numeric: zoom parameter for subplots. When this parameter is smaller the subplot is bigger.

exts

numeric vector: "ext" parameter in tpsgrid() function from "shapes" package

PB

numeric vector: "PB" argument from pslg() function in RTriangle package.

PA

matrix: "PA" argument from pslg() function in RTriangle package.

S

matrix: "S" argument from pslg() function in RTriangle package.

SB

numeric vector: "SB" argument from pslg() function in RTriangle package.

H

matrix: "H" argument from pslg() function in RTriangle package.

V

numeric: "V" argument from triangulate() function in RTriangle package.

a

numeric: "a" argument from triangulate() function in RTriangle package.

q

numeric: "q" argument from triangulate() function in RTriangle package.

Y

logical: "Y" argument from triangulate() function in RTriangle package.

j

logical: "j" argument from triangulate() function in RTriangle package.

D

logical: "D" argument from triangulate() function in RTriangle package.

St

numeric: "S" argument from triangulate() function in RTriangle package.

Q

logical: "Q" argument from triangulate() function in RTriangle package.

constr

logical: if TRUE a constrained triangulation according to links is performed

pholes

list: an optional list of vectors indicating points identifying holes in the input geometries

Author(s)

Paolo Piras

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run:  
### only one plot 
data(macrogroup)
data(my2d)
linksdors<-list(c(1,2),c(37,7),c(12,4),c(27,28),c(25,21),c(38,40),c(9,10),c(2,3),c(3,4),c(1,7),c(1,6),c(3,5),c(6,40),c(5,9),c(40,8),c(8,9),c(1,7),c(7,6),c(3,4),c(4,5),c(39,38),c(38,35),c(35,37),c(37,39),c(35,34),c(34,33),c(33,32),c(32,31),c(31,30),c(30,29),c(29,37),c(37,36),c(36,29),c(28,31),c(28,30),c(13,10),c(10,11),c(11,12),c(12,13),c(13,14),c(14,16),c(16,17),c(17,20),c(20,19),c(19,18),c(18,12),c(18,15),c(15,12),c(21,19),c(21,20),c(24,25),c(25,26),c(26,27),c(27,24),c(26,24),c(24,23),c(23,22),c(22,8),c(8,2))                                                                                                                                                           
amy2d<-procSym(my2d,CSinit=T,scale=F)
plot(amy2d$PCscores[,1:2],asp=1)
pc1seq<-list(scoresequencearray(amy2d$mshape,min(amy2d$PCscores[,1]),max(amy2d$PCscores[,1]),1,amy2d$PCs))
animdefo(amy2d$mshape,pc1seq,linkss=linksdors,linkst=linksdors)
#### multiplot with common zlim value
pc1seq<-scoresequencearray(amy2d$mshape,min(amy2d$PCscores[,1]),max(amy2d$PCscores[,1]),1,amy2d$PCs)
pc2seq<-scoresequencearray( amy2d$mshape,min( amy2d$PCscores[,2]),max( amy2d$PCscores[,2]),2, amy2d$PCs)
pc3seq<-scoresequencearray( amy2d$mshape,min( amy2d$PCscores[,3]),max( amy2d$PCscores[,3]),3, amy2d$PCs)
pc4seq<-scoresequencearray( amy2d$mshape,min( amy2d$PCscores[,4]),max( amy2d$PCscores[,4]),4, amy2d$PCs)
animdefo(amy2d$mshape,list(pc1seq,pc2seq,pc3seq,pc4seq),czlim=T,linkss=linksdors,linkst=linksdors)
#### plot for allometry indicating size values associated to shape change
##### Shape change associated to evolutionary allometry 
regr<-shaperegr(amy2d$orpdata,amy2d$size,links=linksdors,heatmap=T) ### 
myaxtits<-list(paste("Centroid Size=",round(regr$myseq,2)))###
#### 
animdefo(amy2d$mshape,list(regr$seqshapes),czlim=F,czlimw=T,a=0.01,linkss=linksdors,linkst=linksdors,axtit=myaxtits,magrange=1.5)

## End(Not run)

deformetrics/deformetrics documentation built on May 15, 2019, 3:20 a.m.