Convert a Newick tree to SVG format for visualization.
Input:
- A Newick tree file.
- If the file contains multiple trees, only the first tree is processed.
Notes:
- Automatically draws a phylogram if branch lengths are present; otherwise draws a cladogram.
- Underscores (
_) in names are replaced with spaces. - Default styles match the LaTeX Forest template: grey branch lines (1 pt), black node dots (2.5 px), sans-serif font.
- Node visual annotations stored in NHX comments are rendered:
color(text color),label(extra label),dot,bar,rec(subtree background),tri(triangle), andcomment(leaf note).comment,T,S,rank, andmemberare joined into a single leaf comment. - Underscores (
_) in annotation values are replaced with spaces, matchingto-texbehavior. - A scale bar is drawn in phylogram mode, using a 1×/2×/5× dynamic tick algorithm.
--width/-w: SVG canvas width in pixels (default:750). Must be a positive finite number.--vskip/-v: vertical spacing between leaf nodes in pixels (default:30). Must be a positive finite number.
Examples:
-
Convert to SVG
necom nwk to-svg tree.nwk -o tree.svg -
Custom width and spacing
necom nwk to-svg tree.nwk -w 1200 -v 30 -o tree.svg