plot.population.graph: Plot the population as a family tree

Description Usage Arguments Examples

View source: R/family.tree.R

Description

Plot the population as a family tree. Note that prior to using this the alleles shape needs to be added. See the example below. Edges are red from females, black from males. This function is in development, and only works for small populations and quite a lot of massaging with the parameters and layouts.

Usage

1
2
3
plot.population.graph(g, pop.series, tree.layout = NA, vertex.height = 0.02,
  vertex.width = 0.04, edge.width = rep(0.02, length(E(g))),
  edge.arrow.size = 0.35, edge.curved = TRUE, ...)

Arguments

g

igraph created using build.population.graph.

pop.series

The list of populations used to build the population graph.

tree.layout

The tree layout used for plotting

vertex.height

Vertex box height

vertex.width

Vertex box width

edge.width

Edge width of connecting lines

edge.arrow.size

Arrow size of graph

edge.curved

Are the drawn edges curved?

...

other parameters to plot.igraph

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Create a small population of size 10
N <- 10
p <- create_ibm_population(N)
# Create bigger window for population to expand
p$window <- owin(c(-50,50),c(-50,50),unitname="metres")
# Use default parameters for behaviour.
# Note that we require the ids for a tree, so track.ids=TRUE
pop.series <- multiple.step(steps=5,curr.pop=p,move.table=movement.table(),
survival.table(),breeding.table(),habitat.surface=NA,crowding.table(),
track.ids=TRUE)
g <- build.population.graph(pop.series)

# And now add the shape function - depends on the number of
# alleles, so needs to be done after the graph has been built.

add_shape("alleles", clip=shapes("circle")$clip,
       plot=allelebox,parameters=list(vertex.width=1,vertex.height=1,vertex.alleles=length(V(g))))
plot.population.graph(g,pop.series,tree.layout=layout_with_fr(g),asp=1,vertex.height=0.02,vertex.width=0.04)
# Not run - using spatibm package layout
#
# plot.population.graph(g,pop.series,tree.layout=layout_as_tree(g),asp=1,vertex.height=0.02,vertex.width=0.04)
#

pwhigham/spatibm documentation built on Aug. 30, 2019, 1:16 p.m.