TaxonomyMakie — API Reference
PaleobiologyDB.TaxonomyMakie is a package extension that renders TaxonomyTree objects as Makie dendrograms and provides the PBDB–PhyloPic bridge. It activates automatically when both a Makie backend (e.g. CairoMakie) and PhyloPicMakie are loaded.
See the TaxonomyMakie guide for installation instructions, worked examples, and a full attribute reference.
TaxonomyMakie.TaxonomyMakie — Module
TaxonomyMakiePackage extension for PaleobiologyDB.jl that activates when both Makie and PhyloPicMakie are loaded. Provides the full tree-visualization API (moved from the former TaxonomyTreeMakie source submodule) and the PBDB–PhyloPic bridge (vendored from the former PhyloPicPBDB source submodule).
Activated by:
using CairoMakie # or any Makie backend
using PaleobiologyDBPublic API — tree visualization:
| Symbol | Description |
|---|---|
TaxonomyTreePlot | Makie plot type |
taxonomytreeplot | Standalone figure; returns (Figure, Axis, TaxonomyTreePlot) |
taxonomytreeplot! | Add dendrogram to existing axis |
set_rank_axis_ticks! | Label x-axis with rank names |
tip_positions | Leaf-tip coordinates from a tree or plot |
augment_tip_phylopic! | PhyloPic silhouettes at leaf tips |
Public API — PBDB–PhyloPic bridge (re-exported from PhyloPicPBDB):
| Symbol | Description |
|---|---|
acquire_phylopic | Single-taxon or DataFrame enrichment |
augment_phylopic / augment_phylopic! | Glyph overlay on Makie axis |
augment_phylopic_ranges / augment_phylopic_ranges! | Range-anchored glyphs |
phylopic_images_dataframe | All images for a taxon |
phylopic_node | PBDB → PhyloPic node lookup |
phylopic_images | PBDB → PhyloPic images |
phylopic_thumbnail_grid / phylopic_thumbnail_grid! | Gallery figure/axis |
Plot type
TaxonomyTreePlot = Plot{taxonomytreeplot} is the Makie plot type generated by the @recipe macro. For the full attribute table and usage examples, see the TaxonomyMakie guide.
Standalone figure
TaxonomyMakie.taxonomytreeplot — Function
TaxonomyTreePlotMakie plot type for rendering a TaxonomyTree as a rectangular dendrogram. Produced by taxonomytreeplot (standalone figure) or taxonomytreeplot! (existing axis).
Attributes
| Attribute | Default | Description |
|---|---|---|
ladderize | false | Sort children of each node by ascending subtree leaf count |
branch_color | :black | Branch line colour (used when color_by_rank = false) |
branch_linewidth | 1.5 | Branch line width in points |
show_nodes | true | Draw a circular marker at every vertex |
show_unifurcation_nodes | true | When false, suppress markers at single-child (unifurcation) nodes; branch segments are still drawn |
node_color | :black | Node marker colour (used when color_by_rank = false) |
node_size | 5 | Node marker size in points |
color_by_rank | false | Colour branches and nodes by taxonomic rank |
rank_palette | nothing | Dict{String,Any} mapping rank name → colour; nothing uses the built-in cycle |
showtips | true | Show leaf taxon-name labels |
tip_fontsize | 9 | Leaf label font size in points |
tip_color | :black | Leaf label colour |
row_spacing | 2.0 | Vertical gap between consecutive leaf rows in data units; 2.0 gives double-spaced positions, 1.0 uses unit spacing |
tip_xoffset | 0.1 | Rightward offset for leaf labels in data units |
tip_yoffset | 0.0 | Vertical offset for leaf labels in data units (positive = upward) |
showinternal | false | Show internal node name labels |
internal_fontsize | 7 | Internal label font size in points |
internal_color | :gray40 | Internal label colour |
show_phylopic | true | Draw a PhyloPic silhouette to the right of each leaf tip label |
phylopic_glyph_size | 1.0 | Half-height of each silhouette glyph in data units (total height = 2 × phylopic_glyph_size) |
phylopic_align | false | When true, all silhouettes are placed at a single right-hand column; when false, each appears immediately right of its label |
phylopic_xoffset | 0.65 | Additional rightward gap in data units beyond the tip-label start position |
phylopic_yoffset | 0.3 | Vertical offset for PhyloPic silhouettes in data units (positive = upward); applied independently of tip_yoffset |
phylopic_on_missing | :skip | Policy when no PhyloPic image is found: :skip (omit), :placeholder (grey box), :error (throw) |
phylopic_aspect | :preserve | :preserve maintains the original image aspect ratio; :stretch renders as a square |
phylopic_image_rendering | :thumbnail | Image URL to fetch: :thumbnail (PNG thumbnail), :raster (PNG full-res), :og_image (PNG Open Graph), :vector (SVG — requires FileIO SVG plugin), :source_file (SVG or raster); see PhyloPicDB.PHYLOPIC_IMAGE_RENDERINGS |
Examples
using PaleobiologyDB, PaleobiologyDB.Taxonomy
using CairoMakie
using PaleobiologyDB.TaxonomyTreeMakie
tree = taxon_subtree("Carnivora"; leaf_rank = "family")
# Add to an existing Makie axis
fig = Figure(size = (900, 600))
ax = Axis(fig[1, 1])
taxonomytreeplot!(ax, tree; showtips = true, color_by_rank = true)
set_rank_axis_ticks!(ax, tree)
display(fig)See also taxonomytreeplot, taxonomytreeplot!, set_rank_axis_ticks!.
taxonomytreeplot(
tree::TaxonomyTree;
show_rank_ticks::Bool = true,
figure_kwargs::NamedTuple = (;),
axis_kwargs::NamedTuple = (;),
kwargs...,
) -> Tuple{Makie.Figure, Makie.Axis, TaxonomyTreePlot}Create a standalone Makie figure containing a dendrogram of tree.
Returns (fig, ax, plot_object), which can be destructured:
fig, ax, p = taxonomytreeplot(tree; showtips = true)
display(fig)
save("tree.png", fig)Arguments
tree: theTaxonomyTreeto visualise.show_rank_ticks(defaulttrue): whentrue, callsset_rank_axis_ticks!to label the x-axis with rank names.figure_kwargs: keyword arguments forwarded toMakie.Figure(; ...).axis_kwargs: keyword arguments forwarded toMakie.Axis(; ...).- All remaining keyword arguments are forwarded to
TaxonomyTreePlotattributes (seetaxonomytreeplot!).
Examples
using PaleobiologyDB, PaleobiologyDB.Taxonomy
using CairoMakie
using PaleobiologyDB.TaxonomyTreeMakie
tree = taxon_subtree("Carnivora"; leaf_rank = "family")
# Basic dendrogram with tip labels
fig, ax, p = taxonomytreeplot(tree; showtips = true)
save("carnivora_families.png", fig)
# Coloured by rank, ladderized
fig2, ax2, p2 = taxonomytreeplot(tree;
color_by_rank = true,
ladderize = true,
showtips = true,
)
# Custom figure and axis sizes
fig3, ax3, p3 = taxonomytreeplot(tree;
figure_kwargs = (; size = (1200, 800)),
axis_kwargs = (; title = "Carnivora families", yreversed = false),
)See also taxonomytreeplot!, TaxonomyTreePlot, set_rank_axis_ticks!.
taxonomytreeplot(
taxon_name::AbstractString;
leaf_rank::Union{AbstractString, Nothing} = nothing,
strict_leaf_rank::Bool = true,
show_rank_ticks::Bool = true,
figure_kwargs::NamedTuple = (;),
axis_kwargs::NamedTuple = (;),
kwargs...,
) -> Tuple{Makie.Figure, Makie.Axis, TaxonomyTreePlot}Convenience method: look up taxon_name in the PBDB, build its subtree, and render it as a dendrogram in a standalone figure.
Calls taxon_subtree with leaf_rank and strict_leaf_rank, then delegates to taxonomytreeplot. All remaining keyword arguments (recipe attributes such as ladderize, showtips, row_spacing, show_phylopic, etc.) are forwarded unchanged. See TaxonomyTreePlot for the full attribute reference.
Arguments
taxon_name: PBDB taxon name (e.g."Carnivora","Canidae").leaf_rank: prune the subtree at this rank (e.g."family","genus").nothing(default) keeps all descendants.strict_leaf_rank: whentrue(default), only taxa whose rank exactly matchesleaf_rankbecome leaves; passfalseto also include shallower terminals.show_rank_ticks,figure_kwargs,axis_kwargs: forwarded totaxonomytreeplot.
Examples
using PaleobiologyDB, CairoMakie
using PaleobiologyDB.Taxonomy.TaxonomyTreeMakie
fig, ax, p = taxonomytreeplot("Carnivora"; leaf_rank = "family")
save("carnivora.png", fig)
fig2, _, _ = taxonomytreeplot("Canidae"; leaf_rank = "genus", ladderize = true, row_spacing = 1.5)Existing axis
taxonomytreeplot!(ax, tree; kwargs...) — same keyword arguments as taxonomytreeplot. See the TaxonomyMakie guide for usage examples.
Axis helpers
TaxonomyMakie.set_rank_axis_ticks! — Function
set_rank_axis_ticks!(ax::Makie.Axis, tree::TaxonomyTree) -> NothingConfigure the x-axis tick labels on ax to display rank names at their dendrogram x-depth positions.
Only ranks that are present in tree and whose depth is known (i.e. present in _RANK_DEPTH) are labelled. Tick labels are rotated 45° to prevent overlap.
Typically called immediately after taxonomytreeplot!:
p = taxonomytreeplot!(ax, tree; showtips = true)
set_rank_axis_ticks!(ax, tree)taxonomytreeplot (standalone) calls this automatically when show_rank_ticks = true (the default).
Arguments
ax: theMakie.Axison which to set ticks.tree: theTaxonomyTreewhose ranks determine the tick positions.
PhyloPic augmentation
TaxonomyMakie.augment_tip_phylopic! — Function
augment_tip_phylopic!(
ax::Makie.Axis,
tree::TaxonomyTree,
xs::AbstractVector{<:Real},
ys::AbstractVector{<:Real};
anchor::Symbol = :tip,
align::Bool = false,
column_x::Union{Nothing, Real} = nothing,
tip_xoffset::Real = 0.0,
placement::Symbol = :left,
xoffset::Real = 0.0,
yoffset::Real = 0.0,
glyph_size::Real = 0.4,
aspect::Symbol = :preserve,
rotation::Real = 0.0,
mirror::Bool = false,
image_rendering::Symbol = :thumbnail,
on_missing::Symbol = :skip,
) -> NothingAdd one PhyloPic silhouette per leaf tip of tree to ax.
This is the primary tree-aware overlay API. It computes anchor positions from the dendrogram layout and delegates all rendering to augment_phylopic!.
See also the convenience overload augment_tip_phylopic! which reads tree and layout directly from a TaxonomyTreePlot.
Arguments
ax: theMakie.Axisto annotate.tree: sourceTaxonomyTree.xs,ys: layout vectors from_compute_dendrogram_layout, one value per vertex intree.graph.
Keyword arguments
Anchor selection
anchor(default:tip) — how to compute the x-anchor for each leaf::tip— the leaf node's x coordinatexs[v]:tip_label_origin—xs[v] + tip_xoffset
tip_xoffset(default0.0) — label-start offset used whenanchor = :tip_label_origin. Set to match thetip_xoffsetattribute of the correspondingTaxonomyTreePlot(recipe default0.2).
Alignment
align(defaultfalse) — whentrue, all silhouettes share a single x-column. The column x equalsmaximum(anchors)unlesscolumn_xis set.column_x(defaultnothing) — explicit x position for the alignment column; ignored whenalign = false.
Rendering (forwarded to augment_phylopic!)
placement(default:left) — anchor position on the glyph relative to the data coordinate. One of:center,:left,:right,:top,:bottom,:topleft,:topright,:bottomleft,:bottomright.xoffset(default0.0) — additional rightward shift in data units applied after anchoring. This is the parameter to tune when the silhouettes overlap the text labels.yoffset(default0.0) — additional vertical shift in data units.glyph_size(default0.4) — half-height of each silhouette in data units (total height =2 × glyph_size).aspect(default:preserve) —:preservemaintains the original image aspect ratio;:stretchrenders as a square.rotation(default0.0) — clockwise rotation in degrees (multiples of 90° only).mirror(defaultfalse) — flip the silhouette horizontally.image_rendering(default:thumbnail) — PhyloPic image variant to fetch.on_missing(default:skip) — behaviour when no PhyloPic image is found::skip(omit silently),:placeholder(grey rectangle),:error(throw).
Returns
Nothing. Silhouettes are added as side-effects to ax.
Examples
using PaleobiologyDB, PaleobiologyDB.Taxonomy, CairoMakie
using CairoMakie
using PaleobiologyDB
tree = taxon_subtree("Panthera")
fig, ax, p = taxonomytreeplot(tree)
# Silhouettes 1.0 data unit right of each leaf tip
augment_tip_phylopic!(ax, p; xoffset = 1.0)
# Anchor at tip-label origin so silhouettes appear after the text
augment_tip_phylopic!(ax, p;
anchor = :tip_label_origin,
tip_xoffset = 0.2, # match recipe tip_xoffset attribute
xoffset = 0.5,
)
# Aligned column
augment_tip_phylopic!(ax, p; align = true, xoffset = 0.2)See also tip_positions, taxonomytreeplot.
augment_tip_phylopic!(ax::Makie.Axis, p::TaxonomyTreePlot; kwargs...) -> NothingConvenience overload of augment_tip_phylopic! that reads tree and layout from a TaxonomyTreePlot.
All keyword arguments are forwarded unchanged to the primary method. See augment_tip_phylopic! for full documentation.
Examples
fig, ax, p = taxonomytreeplot(taxon_subtree("Panthera"))
augment_tip_phylopic!(ax, p; xoffset = 1.0)TaxonomyMakie.tip_positions — Function
tip_positions(tree::TaxonomyTree, xs, ys) -> NamedTupleExtract leaf-tip coordinates from a pre-computed dendrogram layout.
Returns a NamedTuple with fields:
vertices::Vector{Int}— leaf vertex indices intotree.graphnames::Vector{String}— accepted taxon name for each leafx::Vector{Float64}— x coordinate in data units for each leafy::Vector{Float64}— y coordinate in data units for each leaf
All four vectors are the same length and are aligned by index.
xs and ys are the layout vectors returned by _compute_dendrogram_layout.
Examples
using PaleobiologyDB, PaleobiologyDB.Taxonomy
using CairoMakie
using PaleobiologyDB.TaxonomyTreeMakie
tree = taxon_subtree("Panthera")
fig, ax, p = taxonomytreeplot(tree)
tips = tip_positions(p) # convenience overload
# tips.names, tips.x, tips.y — one entry per leafSee also augment_tip_phylopic!.
tip_positions(p::TaxonomyTreePlot) -> NamedTupleExtract leaf-tip coordinates from a TaxonomyTreePlot object.
Convenience overload of tip_positions that reads the tree and ladderize attribute from p and recomputes the dendrogram layout.
Returns a NamedTuple with fields:
vertices::Vector{Int}— leaf vertex indices intop[:taxonomytree][].graphnames::Vector{String}— accepted taxon name for each leafx::Vector{Float64}— x coordinate in data units for each leafy::Vector{Float64}— y coordinate in data units for each leaf
Examples
using PaleobiologyDB, PaleobiologyDB.Taxonomy, CairoMakie
using CairoMakie
using PaleobiologyDB
fig, ax, p = taxonomytreeplot(taxon_subtree("Panthera"))
tips = tip_positions(p)
# tips.names — Vector{String} of leaf taxon names
# tips.x — x positions in data space
# tips.y — y positions in data spaceSee also tip_positions, augment_tip_phylopic!.