Friday, April 13, 2018

Some new features to modernize plotTree.wBars

After posting a recent hack demonstrating how to plot stacked bars on a fan tree using plotTree.wBars in phytools I decided it might be useful to modernize the function a bit.

One feature I though I could add was dotted linking lines leading from the tip of the tree to either the tip label or the bar for non-ulrametric trees. The reason for this is because it can be very difficult to line-up the bar with its corresponding tip if the some tips terminate before the present.

Another feature that I thought I'd get rid of at the same time is the fact that for all x > 0 the behavior of the function is to attach the bars directly to the tip - regardless of whether or not it terminates in the present.

Here's what I mean:


plot of chunk unnamed-chunk-1



plot of chunk unnamed-chunk-2

Obviously this could be undesirable under some circumstances.

Note that the function does not behave this way when some or all values of x are negative:


plot of chunk unnamed-chunk-3

Let's load the update version from GitHub & see how it compares. Note that we would normally just update phytools from GitHub using devtools.


plot of chunk unnamed-chunk-4

## or

plot of chunk unnamed-chunk-4

## and

plot of chunk unnamed-chunk-4

Note that the default scale is different. The old version used an ignorant scale which could result in some pretty ludicrous plots by default. This should be better.

No comments:

Post a Comment

Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.