View source: R/shift.waffle.ggplot.R
shift.waffle.ggplot | R Documentation |
The function shows changes in allele frequencies between the baseline and future/past climate.
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)
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. |
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).
The function generates a ggplot that depicts changes between baseline and future/past allele frequencies of the populations.
Roeland Kindt (World Agroforestry, CIFOR-ICRAF)
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.