argscape viz#
Standalone visualization of tree sequences without requiring a server.
Synopsis#
argscape viz INPUT [-o OUTPUT] [--format FORMAT] [--mode MODE] [options...]
Description#
The argscape viz command provides a standalone way to visualize tree sequences without starting the full ARGscape web server. It can either open an interactive visualization in a web browser or export static images (PNG, SVG, PDF).
Note
2D visualization (--mode force_graph) works with the base installation.
3D visualization (--mode spatial_3d) requires argscape[spatial].
Static export (-o file.png) requires Playwright: pip install playwright && playwright install chromium
This is useful for:
Quick visualization of tree sequence files
Generating publication-ready figures
Batch processing of multiple files
Integration with analysis pipelines
Positional Arguments#
INPUTPath to the input tree sequence file. Supported formats:
.trees,.ts,.tsz(compressed).
Output Options#
-o, --output PATHOutput file path for static export. Supported extensions:
.png,.svg,.pdf. If not specified, opens the visualization in a web browser for interactive exploration.--format FORMATOutput format when exporting. Choices:
png,svg,pdf. Default: inferred from output filename extension.--dpi DPIResolution for raster output (PNG). Default:
150.
Mode Options#
-m, --mode MODEVisualization mode. Choices:
force_graph- 2D force-directed graph layout (default)spatial_3d- 3D spatial visualization with geographic/temporal dimensions
--interactiveOpen visualization in browser for interactive exploration (implied when no output file is specified).
Sizing Options#
-W, --width PIXELSVisualization width in pixels. Default:
1200.-H, --height PIXELSVisualization height in pixels. Default:
800.
Theme Options#
--theme THEMEColor theme for the visualization. Choices:
tskit- Default tskit-inspired colors (default)liquid- Blue-green fluid themegrayscale- Black and white for publicationspaper- Light theme optimized for print
Subsetting Options#
--max-samples NMaximum number of samples to include in the visualization. Useful for large tree sequences that would be too dense to visualize effectively.
--subset-mode MODEMethod for selecting samples when subsetting. Choices:
even- Evenly spaced samples across the sample range (default)random- Randomly selected samples
--seed SEEDRandom seed for reproducibility when using
--subset-mode random.
Filtering Options#
--genomic-range START,ENDFilter to a specific genomic position range. Format: two comma-separated numbers (e.g.,
0,50000). Only edges overlapping this range will be displayed.--temporal-range MIN,MAXFilter to a specific time range. Format: two comma-separated numbers (e.g.,
0,1000). Only nodes within this time range will be displayed.
Node Options#
--sample-node-size SIZESize of sample (leaf) nodes in pixels. Default:
8.--internal-node-size SIZESize of internal nodes in pixels. Default:
4.--root-node-size SIZESize of root nodes in pixels. Default:
6.--show-sample-idsDisplay labels on sample nodes showing their node IDs.
--show-internal-idsDisplay labels on internal nodes showing their node IDs.
--show-root-idsDisplay labels on root nodes showing their node IDs.
Edge Options#
--edge-width WIDTHLine width for edges. Default:
1.0.--edge-opacity OPACITYOpacity for edges (0.0 to 1.0). Default:
0.6.--show-edge-labelsDisplay labels on edges.
Mutation Options#
--show-mutationsShow mutation markers on edges where mutations occur.
--mutation-size SIZESize of mutation markers in pixels. Default:
6.
Layout Options (2D Force Graph)#
--sample-order ORDERAlgorithm for ordering samples along the x-axis. Choices:
numeric- Order by node IDfirst_minlex- Minimize crossings using first treecenter_minlex- Minimize crossings using center treeconsensus_minlex- Consensus ordering across all trees (default)dagre- Use Dagre graph layout algorithm
--temporal-spacing MODEHow to space nodes vertically by time. Choices:
equal- Equal spacing between time pointslinear- Proportional to actual time values (default)log- Logarithmic scaling of time
--vertical-spacing FACTORMultiplier for vertical spacing between time layers. Default:
1.0.--horizontal-spacing FACTORMultiplier for horizontal spacing between nodes. Default:
100.0.
Spatial Options (3D Mode)#
--geo-base BASEGeographic base map for 3D visualization. Choices:
unit_grid- Simple unit coordinate grid (default)eastern_hemisphere- Eastern hemisphere map projection
--temporal-multiplier FACTORScaling factor for the Z-axis (time dimension) in 3D view. Default:
1.0.--spatial-multiplier FACTORScaling factor for X-Y spatial coordinates in 3D view. Default:
100.0.
Examples#
Open a tree sequence in the browser for interactive exploration:
argscape viz simulation.trees
Export a high-resolution PNG:
argscape viz simulation.trees -o figure.png --dpi 300
Export an SVG for publication with grayscale theme:
argscape viz simulation.trees -o figure.svg --theme grayscale
Visualize with mutations shown and custom node sizes:
argscape viz simulation.trees -o output.png --show-mutations --sample-node-size 12
Visualize a specific genomic region:
argscape viz large_genome.trees -o region.png --genomic-range 0,100000
Subset a large tree sequence to 100 samples:
argscape viz large.trees -o subset.png --max-samples 100 --subset-mode random --seed 42
3D spatial visualization:
argscape viz spatial_data.trees -o spatial.png --mode spatial_3d --temporal-multiplier 2.0
Create a wide figure with custom dimensions:
argscape viz data.trees -o wide_figure.png --width 2400 --height 600
Exit Codes#
0- Success1- Error (file not found, visualization error, export error)