Visualizing landmark covariance in 3D landmarks

14 views
Skip to first unread message

Ricardo Ely

unread,
Oct 27, 2025, 11:58:43 AMOct 27
to geomorph R package
Hello again, 

I'm trying to develop several plots to show covariances between landmarks in the MarkMyBird 3D semilandmark dataset. This figure gives a good idea of what I'm attempting (Machado et al. 2018): 

Details are in the caption following the image

Except, this figure shows flexibility, evolvability, and allometry rather than simple covariance. And, we prefer 3D landmark plots, as we're working with three semilandmark curves of the bird beak. Plus, we would strongly prefer a method that shows only landmark pairs with significant covariances. In MMB, there's 79 landmarks total, and displaying lines between each landmark pair makes for a messy plot. Is there a known approach to plot significant covariances between landmarks? Morpho::lineplot() seems to be the obvious choice for plotting purposes. 

Best, 

Ricardo Ely 
University of Copenhagen 

Mike Collyer

unread,
Oct 28, 2025, 8:56:11 AMOct 28
to geomorph-...@googlegroups.com
Dear Ricardo,

I would not expect that there is some ready-to-go function that could do what you wish but it is probably not overly challenging to use a for loop or apply function to accomplish this.  For example, with 2d plots, one could do something like this, using Cov as a covariance matrix and Y as a matrix of points used for plotting the configuration.

D <- as.dist(abs(Cov), diag = FALSE)
D <- as.vector(D)

L <- combn(p, 2, simplify = FALSE) # p is the number of points; L is a list of all pairs of landmarks


drawline <- function(d, t, v1, v2, ...){# v1 and v2 are vectors; t = threshold, d = covariance
  if(d >= t)
    points(rbind(v1, v2), type = "l", ...)
}

thresh <- 0.3 # covariance magnitude to plot

for(i in 1:length(L)){
  d <- D[i]
  pts <- L[i]
  v1 <- Y[pts[1], ]
  v2 <- Y[pts[2], ]
  drawline(d, thresh, v1, v2, lwd = d * 4, col = 2) # line thickness based on covariance strength
}

I did not try this with data, so my coding might be flawed, but I hope the concept is clear.

Good luck!
Mike



--
You received this message because you are subscribed to the Google Groups "geomorph R package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geomorph-r-pack...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/geomorph-r-package/62e674eb-cda7-4295-905a-d0bbdffb771bn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages