DemesDraw is a python package for drawing Demes demographic models. It can be installed with pip.
python3 -m pip install demesdraw
Or with conda.
conda install -c conda-forge demesdraw
Population size history#
size_history() function plots the population size as a
function of time for each deme in the graph. This is great for single-deme
graphs like the ZigZag model from Schiffels & Durbin et al. (2014).
zigzag = demes.load("../examples/stdpopsim/HomSap__Zigzag_1S14.yaml") demesdraw.size_history(zigzag, invert_x=True, log_time=True);
Multi-deme models can also be plotted with
E.g., below we plot the human out-of-Africa model from Gutenkunst et al. (2009).
Lines for distinct demes are given different colours and widths,
with thinner lines drawn on top of thicker lines. Ancestor/descendant
relationships are indicated as dotted lines.
gutenkunst_ooa = demes.load("../examples/stdpopsim/HomSap__OutOfAfrica_3G09.yaml") demesdraw.size_history(gutenkunst_ooa, invert_x=True, log_size=True);
Demes as tubes#
tubes() function plots a “demes as tubes”-style schematic
overview. Compared with the size-history figure above, this more fully
captures the relationships between demes.
Ancestor/descendant relationships are indicated as solid lines with
open arrow heads pointing from ancestor to descendant, and migrations are drawn
as thin lines with closed arrow heads pointing from source to destination.
gutenkunst_ooa = demes.load("../examples/stdpopsim/HomSap__OutOfAfrica_3G09.yaml") demesdraw.tubes(gutenkunst_ooa, num_lines_per_migration=6, log_time=True, seed=1234);