ontrajplot: ontrajplot

Description Usage Arguments Value Author(s) Examples

Description

This function plots in 2D or 3D, with or without heatmap, the ontogenetic trajectories of data transported according to the Linear Shift procedure implemented in ptau6() function. It takes a ptau6 object and use it to plot per-group predictions evaluated at user-defined equally spaced size values within per-group size ranges. The user can choose to plot landmarks only, landmarks with links, deformation grids (for 2D data) only, heatmap+deformation grids (for 2D data), heatmap in 3D or just mesh with triangulation in 3D.

Usage

1
2
3
4
5
ontrajplot(objptau, z = 5, triang = NULL, links = NULL, heat = F,
  grid2d = T, linkss = T, linksscol = 2, lwdt = 1, lwds = 1,
  scaleramp = F, heatcolors = c("blue4", "cyan2", "yellow", "red4"),
  polyn = 1, mar = c(0.3, 0.3, 0.3, 0.3), mai = c(0, 0, 0.3, 0),
  oma = c(0, 0, 3, 0), mag = 1, levelcex2d = 1,levelcex3d=1,exts=NULL)

Arguments

objptau

list: an object resulting from ptau6() function

scaleramp

logical: "scaleramp" argument in meshDist() function in "Morpho" package

heatcolors

character: Color palette for heatmap (by default=c("blue4","cyan2","yellow","red4"))

polyn

numeric: the degree of regression. This should equal the same argument in ptau6().

mar

numeric: "mar" argument in par() (default=c(0.3,0.3,0.3,0.3))

mai

numeric: "mai" argument in par() (default=c(0,0,0.3,0))

oma

numeric: "oma" argument in par() (default=c(0,0,3,0))

mag

numeric: magnification parameter

levelcex2d

numeric: text size for group names for 2D data

levelcex3d

numeric: text size for group names for 3D data

exts

numeric: a vector of length equal to the total number of subplots with "ext" values argument of tpsgrid() function in "shapes" package

z=5

numeric: the number of predictions evaluated at equally spaced size values on per-group ranges.

triang=NULL

list: triangulation structure for 3D data

links=NULL

list: links structure

heat=F

logical: if TRUE the heatmap is estimated. Necessarily slow.

grid2d=T

logical: if TRUE the TPS grid is calculated and displayed

linkss=T

logical: if TRUE links on the source configuration, i.e. the most juvenile "starting shape, are plotted (only for 2D data).

linksscol=2

numeric: links color for the source configuration.

lwdt=1

numeric: links width for target.

lwds=1

numeric: links width for target.

Value

factorord the factor ordered by ptau() and outputted by that function.

z the number of per-group predicitons to be saved.

m the number of dimensions

links links if specified

triang triangulation if specified

linkss Logical. If TRUE links on source were specified.

heat Logical. If TRUE heatmap has been estimated.

grid2d Logical. If TRUE deformation grids in 2D have been estimated.

traspred Predictions transported according to Linear shift Parallel Transport strategy and evaluated at equally spaced size values within per-group size ranges.

origpred Classical MANCOVA predictions evaluated at equally spaced size values within per-group size ranges.

serfac A factor with z individuals per each level in factorord

themaxt The largest configuration among all transported predictions. It is used for setting axes limits if analyses are done in Size and Shape Space.

themaxo The largest configuration among all MANCOVA predictions. It is used for setting axes limits if analyses are done in Size and Shape Space.

traspred2 The same as traspred but with z+1 individuals for each level in factorord

origpred2 The same as origpred but with z+1 individuals for each level in factorord

serfac2 The same as serfac but with z+1 individuals for each level in factorord

alphas A vector with 0 or 1 indicating the alpha parameter for each subscene in the main plots with z entries for each level in factorord

alphas2 The same as alpha with z+1 entries for each level in factorord

allobsp The log(determinant) of the jacobian matrix evaluated within the body of interest for transported predictions. This is a list with z entries for each level in factorord. Details for calculation can be found in Marquez et al (2012).

allithsp A list with meshes colored with heatmap (in 3D) or images (in2D) for transported predictions.

allobso The log(determinant) of the jacobian matrix evaluated within the body of interest for original per-group predictions (not transported).

allithso A list with meshes colored with heatmap (in 3D) or images (in2D) for original predictions.

allobsp2 The same as allobobsp but with z+1 entries for each level in factorord.

allithsp2 The same as allithsp but with z+1 entries for each level in factorord.

allobso2 The same as allobobso but with z+1 entries for each level in factorord.

allithso2 The same as allithso but with z+1 entries for each level in factorord.

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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## Not run:  
####  2D example
data(group)
data(my2d)
mysel<-group%in%c("Macroscelides_proboscideus","Petrodromus_tetradactylus","Elephantulus_rozeti","Elephantulus_edwardii")
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))       
dors4<-my2d[,,mysel]
factordors4<-drop.levels(group[mysel],reorder=T)
factordors4<-factor(factordors4,levels=unique(factordors4))
adors4<-procSym(dors4,scale=F,pcAlign=F,reflect=F)
mypredictbook<-read.inn(predict(lm(array2mat(adors4$orpdata,105,80)~poly(adors4$size,1,raw=T)*factordors4)),40,2)
procbook<-procSym(mypredictbook,pcAlign=F)
# linear shift in the shape space
plot(procbook$PCscores[,1:2],pch=as.numeric(factordors4),asp=1)
objptau2d<-ptau6(dors4,factordors4,CSinit=T,perm=2)
ontra20<-ontrajplot(objptau2d,links=linksdors,grid2d=F)#### just shapes
ontra21<-ontrajplot(objptau2d,links=linksdors,heat=F,mag=2)#### tpsgrid
replotontraj(ontra21)##replot rapidly
ontra22<-ontrajplot(objptau,links=linksdors,heat=T,mag=2)#### tpsgrid and heatmap necessarily slow
replotontraj(ontra22,zlimo=c(-3,2)) ##replot rapidly by adjusting zlim for original per group predictions 
########  3D example
data(pri3d)
data(linksbase)
data(linksface)
data(linksentire)
data(sur_ent)
data(sur_fac)
data(sur_bas)
data(my2d)
data=pri3d
my3d<-centershapes(data)
amy3d<-procSym(my3d)
group<-factor(substr(dimnames(amy3d$orpdata)[[3]],1,7))
objptau3<-ptau6(amy3d$orpdata,group,CSinit=T,perm=2)
## not run
ontra31<-ontrajplot(objptau3, links=NULL)#### only shapes with links
ontra32<-ontrajplot(objptau3,triang=t(sur_ent$it)) ## only meshes no heatmap
replotontraj(ontra32,zlimo=c(-3,2))##replot rapidly
ontra33<-ontrajplot(objptau3,triang=t(sur_ent$it),heat=T,mag=1)#### mesh with heatmap in 3D; necessarily slow: about 20 minutes
replotontraj(ontra33)##replot rapidly the object
replotontraj(ontra33)##replot rapidly the object

## End(Not run)

evoshape/deformetrics documentation built on May 16, 2019, 9:41 a.m.