shift.waffle.ggplot {AlleleShift} | R Documentation |
Shifts of Allele Frequencies as Response to Climate Change
Description
The function shows changes in allele frequencies between the baseline and future/past climate.
Usage
shift.waffle.ggplot(future.waffle,
manual.colour.values = c("black", "grey", "firebrick3", "chartreuse4"),
manual.colour.codes = c("A baseline ", "B", "A decreasing", "A increasing"))
waffle.baker(freq.in, sort.index = "Pop.index",
mean.change = FALSE, change.FUN = stats::median)
Arguments
future.waffle |
Result from |
manual.colour.values |
Colours to be used in the plot. |
manual.colour.codes |
Sequence for the manual colour values. |
freq.in |
Result from |
sort.index |
Sequence of the populations in the plot. |
mean.change |
Aggregate changes among alleles. |
change.FUN |
Function used the aggregate changes. |
Details
Althought a package ggwaffle
exists, I opted to bake my own waffles (possibly the Belgian in me.). As a separate row is created for each square/rectangle of the waffle, the resulting data is quite large. Hence trying to animate this is probably a bad idea (unless you want to make some real waffles while your computer is busy).
Value
The function generates a ggplot that depicts changes between baseline and future/past allele frequencies of the populations.
Author(s)
Roeland Kindt (World Agroforestry, CIFOR-ICRAF)
Examples
# The data can be obtained via the count.model and freq.model calibrations.
# These procedures are not repeated here.
data(Poptri.freq.baseline)
data(Poptri.freq.future)
Poptri.future.waffle <- waffle.baker(Poptri.freq.future,
sort.index="Latitude.index")
ggwaffle1 <- shift.waffle.ggplot(Poptri.future.waffle)
ggwaffle1