Visualize Clade Recovery and Support Across Phylogenetic Trees

Generates rug plots on a reference tree to compare and visualize multiple phylogenetic trees clade by clade. Records clade recovery and node support and draws them on every internal node as a phylogenetic rug plot, a small grid with one cell per comparison tree. Accepts any number of trees from different phylogenetic and phylogenomic analyses, with node support in different metrics, and shows where the trees agree and where they conflict (incongruence).


phylorug

R-CMD-check License:MIT Project Status:Active Codecov testcoverage CRANstatus

phylorug is an R package for comparing phylogenetic trees clade by clade. It takes any number of trees inferred for the same taxa with different inference pipelines, datasets or statistical models, and draws a compact coloured grid, a rug plot, at each internal node of a reference tree, with one cell per comparison tree; thus, a single figure shows which clades are recovered and supported across the trees, and where the trees conflict. In presence mode, a solid dot replaces the rug plot at nodes recovered by all comparison trees. In support mode, the dot is stricter: every comparison tree must also rate the clade as high support. Contested or mixed-support nodes keep a full rug plot, which shows each analysis individually.

A phylogenetic rug plot made with phylorug

Support mode: rug plots comparing five phylogenetic trees of 43 Onthophagina taxa from the bundled beetles_70p data Support mode: rug plots comparing five phylogenetic trees of 43 Onthophagina taxa from the bundled beetles_70p data

Five analyses of 43 dung beetle taxa from the bundled beetles_70p data (Montanaro et al., 2026): an IQ-TREE backbone compared with a partitioned IQ-TREE, a GHOST and two ASTRAL analyses, in support mode with the "classic" palette and rug plots centred on the nodes. Each cell is one comparison tree: green, blue and light grey mark high, moderate and low support, and white means the clade was not recovered. One very long branch is shortened for display.

High support is not the same as stability: 11 of the 36 clades with full backbone support (SH-aLRT/UFBoot2 100/100) are missing from at least one of the other four trees.

Overview

Phylogenetic studies routinely apply multiple analytical approaches to infer relationships within a focal group of organisms. Different inference methods, datasets, and models yield trees that may differ in topology (incongruence) and report nodal support using different metrics and formats. Assessing the robustness of phylogenetic results therefore requires comparing clade recovery and support across analyses, typically relative to a selected backbone tree.

A convenient way to visualize this kind of phylogenetic tree comparison is a phylogenetic rug plot, in which each node of the backbone tree is associated with a series of cells representing different analyses. Each cell indicates whether a clade was recovered and, where applicable, its level of support. Rug plots give an intuitive, clade-level overview of stability across alternative phylogenetic analyses, but compiling them manually is tedious and time-consuming. Despite the extensive use of R in the phylogenetics community, no dedicated R package exists for generating such plots.

phylorug fills this gap. It operates in two modes:

Presence mode

Presence mode: rug plots comparing clade recovery across five phylogenetic trees of 9 beetle taxa Presence mode: rug plots comparing clade recovery across five phylogenetic trees of 9 beetle taxa

Black/white cells showing whether each analysis recovered a given clade or not. Stable nodes appear as black dots; contested nodes show a rug plot.

Support mode

Support mode: rug plots comparing clade support across five phylogenetic trees of 9 beetle taxa Support mode: rug plots comparing clade support across five phylogenetic trees of 9 beetle taxa

Each cell is coloured by how strongly that analysis supports the clade, in three tiers: high, moderate and low. White means the clade was not recovered; a fourth colour means it was recovered but has no support value (“not computed”). The figure above uses palette = "classic": green, blue and light grey, with yellow for not computed. The default, palette = "grey", uses black, grey and pale grey and prints well in black and white.

Ten palettes are available, including colour-blind-safe Okabe-Ito and palettes from RColorBrewer and ggsci; see ?plot_phylorug for the list.

Each support value is binned against its own metric’s thresholds: UFBoot2 95 and LPP 0.95 are never treated as equivalent. Default thresholds are provided, but users are encouraged to set their own. Supported metrics are UFBoot2, SH-aLRT, standard bootstrap, transfer bootstrap, jackknife, Bayesian posterior probability, ASTRAL local posterior probability (LPP) and Bremer support (as a ratio).

In support mode a dot is stricter than in presence mode: it appears only where every comparison analysis recovers the clade and rates it high support. A clade recovered everywhere but with weaker or missing support in even one analysis is drawn as a full rug plot instead. Set dot_on_high = FALSE to draw a grid at every node.

The entire workflow runs in R, from reading raw tree files to publication-ready figures. The package was developed around a dung beetle phylogenomic dataset (Montanaro et al., 2026) and includes three bundled datasets so users can try the pipeline on real data before applying it to their own.

Figures show a 9-taxon subset of sample_trees (tip labels cleaned) for readability. One very long branch is shortened for display.

Installation

Install the released version from CRAN:

install.packages("phylorug")

Or install the development version from GitHub:

# install.packages("pak")
pak::pak("mdrifathahamed/phylorug")

Quick example

library(phylorug)

# Load example trees from the package data
data(sample_trees)

# Select backbone and comparison trees
backbone <- sample_trees[["70p_uce"]]
others   <- sample_trees[names(sample_trees) != "70p_uce"]

# Check that all trees share the same set of taxa (recommended but optional)
check_taxa(backbone, others)

# Build the node presence matrix
# support_type only matters for support mode — skip it if you just want 
# presence/absence
npm <- node_presence_matrix(backbone, others, support_col = 1, support_type = c(
                "70p_ASTRAL_partition_entropy" = "lpp",
                "70p_ASTRAL_uce"               = "lpp",
                "70p_ghost"                    = "sh_alrt",
                "70p_partition_entropy"        = "sh_alrt"))

# Presence mode: Which analyses recover each clade?
plot_phylorug(backbone, npm)

# Support mode: How strongly?
plot_phylorug(backbone,
                   npm, 
                   mode = "support")

Core functions

phylorug provides eight functions that cover the full workflow from raw tree files to publication-ready figures:

  • read_trees() reads all Newick and Nexus tree files from a directory. So you don’t need to load each file individually.
  • node_presence_matrix() builds the comparison matrix recording which clades are recovered by which analyses, along with their support values.
  • plot_phylorug() draws the rug plot on a reference tree.

That is the basic pipeline: read -> matrix -> plot. Five additional helpers are available when your data needs them:

  • check_taxa() Validates that the backbone and comparison trees share an identical set of taxa, reporting any missing or extraneous tips. Use this diagnostic function between read_trees() and node_presence_matrix() to pinpoint exact tip mismatches before the pipeline halts.

  • translate_tips() Rename tip labels between naming conventions using a lookup table (e.g. specimen codes to species names).

  • prune_to_shared() drops taxa that are not present in all trees, keeping only the shared set. Useful when comparison trees lack some taxa found in the backbone.

  • add_tree() Appends new comparison trees directly to an existing node presence matrix (the object generated by node_presence_matrix()) without requiring a complete recalculation of the pipeline.

  • add_rug_plots() adds rug plots to a tree you have already drawn with ape::plot.phylo() or phytools (plotTree(), plotSimmap(), contMap()). Use it when you want coloured branches, mapped characters or other phytools features under the rug plots.

Tutorials

  • Introduction to phylorug, or vignette("phylorug"): the full workflow, from reading tree files to a finished figure.
  • phylorug with ape and phytools, or vignette("phylorug-phytools"): coloured branches, painted clades, stochastic maps and contMap() with rug plots on top.

Dependencies

phylorug requires R (>= 4.1.0) and imports only ape and phangorn; everything else it uses comes with base R. phytools is optional and is needed only for the phytools tutorial.

Additional features

  • Handles compound IQ-TREE labels (e.g. SH-aLRT/UFBoot2). User selects which slot to extract via support_col in node_presence_matrix(), and controls what appears on the tree via show_support_idx in plot_phylorug()
  • Treats a bare "multiPhylo" as one analysis (a pool of tied-optimal trees). Whether a clade counts as present depends on pool_threshold: 1.0 (default) requires all pool trees to recover it (strict consensus), 0.5 requires a majority.
  • Rug plots can sit "inside" or "outside" the node, or be "centre"d on it. With "centre", backbone support labels are placed beside the rug plot instead of on top of it
  • legend_cex enlarges or shrinks the legends; scale_bar adds a branch-length scale bar (e.g. scale_bar = 0.02)
  • Backbone support values can be displayed alongside rug cells via show_support
  • Unanimous nodes are collapsed to dots by default. In presence mode, dot_identical = FALSE shows rug plots on every node. In support mode, dot_on_high = FALSE does the same, revealing support variation even at unanimous nodes.
  • nodes lets users choose which nodes get rug plots, so the rest of the tree stays clean and only the nodes of interest show rug plots.
  • Saves directly to PDF, PNG, or JPEG via the file argument.

Getting help

An overview of the package: ?phylorug

If you find a bug or have a feature request, please open an issue on GitHub.

Citation

If you use phylorug in a publication, please cite:

Ahamed, M.R., Arias, J.S., and Tarasov, S. (2026). phylorug: Visualize Clade Recovery and Support Across Phylogenetic Trees. R package version 0.2.0. https://doi.org/10.32614/CRAN.package.phylorug

Acknowledgements

This package was developed at the Finnish Museum of Natural History (LUOMUS) (https://www.helsinki.fi/en/luomus), University of Helsinki, as part of an MSc thesis in Ecology and Evolutionary Biology under the supervision of Sergei Tarasov and J. Salvador Arias.

In phylogenetics, rug plots were first used by Wheeler (1995) as “analysis space plots” and were later named “Navajo rugs” by Giribet (2003). Cladescan (Sanders 2010) and YBYRÁ (Machado 2015) first automated their generation. phylorug brings rug plots to R and extends them from parameter sensitivity to comparing trees from different phylogenetic analyses. The full references are in vignette("phylorug").

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("phylorug")

0.2.0 by Md Rifath Ahamed, 8 hours ago


https://github.com/mdrifathahamed/phylorug, https://mdrifathahamed.github.io/phylorug/


Report a bug at https://github.com/mdrifathahamed/phylorug/issues


Browse source code at https://github.com/cran/phylorug


Authors: Md Rifath Ahamed [aut, cre, cph] (ORCID: , J. Salvador Arias [aut] (ORCID: , Sergei Tarasov [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports ape, graphics, grDevices, phangorn, stats, tools, utils

Suggests knitr, mockery, phytools, rmarkdown, svglite, testthat


See at CRAN