Description Usage Arguments See Also Examples
This function plots migration events at a particular time point based on the output of PlotMS
with demo.out
= T and plot.out
= F. The time_pt
or event
determines the time points that are plotted. The add
and map.pos
parameters allow the migration graph to be added to other backgrounds such as maps.
1 2 3 4 5 6 7 8 | PlotMig(time_pt = NULL, event = 1, mig_par, demograph_out,
size.scale = mig_par$size.scale, time.scale = mig_par$time.scale,
linear.scale = mig_par$linear.scale, log.base = mig_par$log.base,
col.pop = mig_par$col.pop, col.arrow = mig_par$col.arrow,
xlim = mig_par$xlim, ylim = mig_par$ylim, lwd.arrow = mig_par$lwd.arrow,
length.arrowtip = mig_par$length.arrowtip,
angle.arrowtip = mig_par$angle.arrowtip, toposize.scale = 1,
add = FALSE, map.pos = NULL, m.adjust = 0)
|
time_pt |
A numeric value defining the time point for the migrations which will be plotted. |
event |
An index to define at which time to plot migration(s). Every demographic event has an index in the order of time. Demographic changes at the same time are all defined as the same event and share the same index. |
mig_par |
A list contained all settings for plotting the demographic graph, see |
demograph_out |
A list containing all demographic information, see |
size.scale |
A keyword to define the scaling of lineage width. "topology" returns only topology structure among simulated populations, ignoring both the population sizes and the length of time between any demographic events. "linear" linearly scales the lineage widths as a function of the population size, with the scale factor defined by the variable |
time.scale |
A keyword to define the time scale used in the plot. It can be "4Ne", "generation", "year", "kyear", and "log10year". When the |
linear.scale |
Linear scale magnitude, to be applied when |
log.base |
The base of logarithm, to be applied when |
col.pop |
Population lineage color. |
col.arrow |
Migration arrow color. |
xlim |
The range of x-axis. |
ylim |
The range of y-axis. |
lwd.arrow |
Control the line width of arrow representing a migration. The arrow width is defined by 0.5+migration strength* |
length.arrowtip |
Length of the edges of the arrow tip. |
angle.arrowtip |
The angle of the arrow tip, between 0 and 90. |
toposize.scale |
Control the scaling of the size of circle when the |
add |
A logical value allowing one to add the migrations to another background (2-D only). Positions for every population dime should be defined in |
map.pos |
A matrix with two columns, the ith row is the coordinate for the ith population. |
m.adjust |
Migration threshold for plotting migration events. Migration events with strength higher than |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | test.mig.cmd <- "./ms 15 100 -t 3.0 -I 6 0 7 0 0 8 0 -m 1 2 2.5 -m 2 1 2.5
-m 2 3 2.5 -m 3 2 2.5 -m 4 5 2.5 -m 5 4 2.5 -m 5 6 2.5 -m 6 5 2.5
-em 2.0 3 4 2.5 -em 2.0 4 3 2.5"
out <- PlotMS(input.cmd = test.mig.cmd, type = "ms",
N4 = 10000, plot.out = FALSE, demo.out = TRUE);
#check all migration events
events <- out$mig_par$events
print(events)
#check the time for those migration events
timeofevents <- out$mig_par$time[events]
print(timeofevents)
#plot event by event
par(mfrow = c(1, 2))
PlotMig(event = 1, demograph_out = out$demograph_out, mig_par = out$mig_par)
title("Event-1");
PlotMig(event = 2, demograph_out = out$demograph_out, mig_par = out$mig_par,
col.pop = 1:6, xlim = c(-5,4))
title("Event-2", cex.main = 3);
legend("topleft", col = 1:6, pch = 20, bty = "n", cex = 2,
legend = c("pop-1", "pop-2", "pop-3", "pop-4", "pop-5", "pop-6"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.