This function is a wrapper around plot.igraph
, written
to group parasite genotypes by infection, both spatially and using vertex
colour. Specifically, parasite genotypes within infections are vertically
distributed with some horizontal jitter when layout_by_group
is TRUE
(default), and coloured the same. It also makes sure clonal and sibling edges
are plotted differently using different line types.
Arguments
- RG
A relationship graph, which is an
igraph
graph; see return value ofRG_to_igraph
.- layout_by_group
A logical argument which if TRUE (default) overrides the default layout of
plot.igraph
so that vertices that represent parasite genotypes from different infections are distributed horizontally and vertices that represent genotypes within infections are distributed vertically.- vertex_palette
A character string specifying an RColorBrewer palette. Overrides the default
palette
ofplot.igraph
.- edge_lty
A vector of edge line types corresponding to different relationships, where 0.5 represents a sibling and 1 represents a clone.
- edge_col
A vector of edge colours corresponding to different relationships, where 0.5 represents a sibling and 1 represents a clone.
- edge_width
Overrides the default
edge.width
ofplot.igraph
.- ...
Additional arguments to pass to
plot.igraph
, e.g.edge.curved
.
Provenance
This function was adapted from plot_Vivax_model
at
https://github.com/jwatowatson/RecurrentVivax/blob/master/Genetic_Model/iGraph_functions.R.
Examples
RGs <- enumerate_RGs(c(2, 1, 1))
#> Number of valid relationship graphs (RGs) is 48
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> =
#> ==
#> =
#> ==
#> ==
#> |
cpar <- par() # record current par before changing
par(mfrow = c(3, 4), mar = c(0.1, 0.1, 0.1, 0.1))
for (i in 12:23) {
plot_RG(RGs[[i]], edge.curved = 0.1)
box()
}
par(cpar) # reset par
#> Warning: graphical parameter "cin" cannot be set
#> Warning: graphical parameter "cra" cannot be set
#> Warning: graphical parameter "csi" cannot be set
#> Warning: graphical parameter "cxy" cannot be set
#> Warning: graphical parameter "din" cannot be set
#> Warning: graphical parameter "page" cannot be set