Skip to content

Visualization

Caroline Fortier edited this page Sep 6, 2026 · 1 revision

Visualization

The principal visualization interface in PhyloGeoPlot is PhyloGeoPlotter.

It combines a phylogenetic tree with geographic occurrence data and can optionally display an environmental raster.

Basic example

from phylogeoplot.visualisation.tree_to_map_raster import PhyloGeoPlotter

plotter = PhyloGeoPlotter(
    nwk_file="sequences_tree.nwk",
    gps_file="coordinates.csv",
    offset_file="offsets.csv",
    raster_file="environment.tif",
    raster_band=1,
)

plotter.plot()
plotter.save(output_dir="output")

Without a raster

Raster input is optional.

A tree-map visualization can be generated without an environmental layer when only phylogenetic and geographic occurrence information is required.

Linked tree-map representation

PhyloGeoPlot places the phylogenetic tree and geographic map within a common figure and draws connections between corresponding phylogenetic and geographic elements.

This allows the viewer to examine:

  • phylogenetic relationships;
  • geographic distribution;
  • correspondence between tree tips and mapped records;
  • optional trait information;
  • optional environmental context.

Trait color encoding

Quantitative traits can be represented using a continuous color scale.

The same encoding can be applied across:

  • tree elements;
  • occurrence points;
  • connecting lines.

Raster visualization

When a GeoTIFF raster is supplied, PhyloGeoPlot can display an environmental background layer behind occurrence points.

Typical examples include:

  • elevation;
  • precipitation;
  • temperature;
  • vegetation indices;
  • other continuous environmental variables.

Raster bands can be selected with the raster_band parameter.

Geographic extent

The displayed map extent can be adjusted to focus on the study area.

Offsets

Offset values can be provided to improve visual separation of tree nodes, labels, or connecting lines.

Plotting

plotter.plot()

Saving output

plotter.save(output_dir="output")

Depending on the configured workflow, figures may be exported as:

  • PNG;
  • SVG;
  • PDF.

Example figures

https://github.com/tahiri-lab/PhyloGeoPlot/tree/main/images

See Examples for complete walkthroughs.

Clone this wiki locally