R 'phytools' dotTree function does not seem to accept my dataset/tree?

16 Views Asked by At

I'm trying to show phylogenetic signaling of a trait and plot a tree with dots at the end such that the dots size is indicative of trait value. But my dotTree function is giving me the following error:

dotTree(Main_tree, topt_main_matrix) Error in x[tree$tip.label, ] : subscript out of bounds

For reference, Main_tree (phylo object) is generated from topt_main_matrix (matrix and array object), so I know it's not a mismatch between the tree and the dataset. topt_main_matrix has two columns: one is the species names (matching the phylogenetic tree) and the other column is trait values.

Any idea where I'm going wrong?

I've tried specifying that I want to graph the second column (trait values) by changing the above code to this: dotTree(Main_tree, topt_main_matrix[,2])

But it then gives me a phylogeny and then a bunch of random colorful dots across the plot. (see image).

Any idea how I can fix this ?

0

There are 0 best solutions below