Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow styling of nodes within phylogram.plot() #16

Merged
merged 20 commits into from
Aug 8, 2021

Conversation

ms609
Copy link
Contributor

@ms609 ms609 commented Jun 8, 2021

There are a number of settings where it is useful to be able to style the vertical lines associated with polytomies (example).
I'm hoping that it would be possible to extend the functionality of plot.phylo() to support this.

This PR adds node.color, node.width and node.lty parameters that allow nodes to be styled separately from their pendant edges. If these parameters are unspecified, the existing behaviour of plot.phylo() remains unchanged.

If node.color (etc.) parameters are specified and edge.color is unspecified, then edge colours will be inferred based on the child node.

Example output:

library('TreeTools') # For CollapseNode, BalancedTree
plot(CollapseNode(BalancedTree(10), 18),
     edge.color = viridisLite::plasma(18),
     node.color = c(rep('blue', 10), rev(viridisLite::inferno(9))),
     node.lty = c(rep('solid', 15), rep('dotted', 1), rep('dashed', 2)),
     edge.lty = 'solid',
     node.width = c(rep(1, 10), 1:8),
     edge.width = (1:17) / 2
     )

image

plot(CollapseNode(BalancedTree(10), 18),
     direction = 'upwards',
     node.color = c(rep('red', 10), rep('grey', 4), rep('red', 2), 'green', 'red'))

image

I've checked a few basic test cases – but is there a standard set of test plots that I should verify reproduced correctly with the new code?

I have not attempted to extended this functionality to plotting types other than "phylogram".

@emmanuelparadis emmanuelparadis merged commit 1a7fa42 into emmanuelparadis:master Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants