plot_joyplot_frequencies {GenomeAdmixR} | R Documentation |
make a joy plot of the distribution of allele frequencies within a region
Description
This function plots the distribution of allele frequencies within a region over time, making use of a 'joyplot'
Usage
plot_joyplot_frequencies(
frequencies,
time_points,
picked_ancestor = "ALL",
picked_population = 1
)
Arguments
frequencies |
A tibble containing four columns: |
time_points |
A sequence of time points for which the user wants to create the joyplot |
picked_ancestor |
Default is "ALL", where different colors indicate different ancestors. Alternatively, for clarity, the user can specify a specific ancestral allele, and only that allele is plotted |
picked_population |
If multiple populations were simulated (in the case
of |
Value
a ggplot object
Examples
s <- 0.01
select_matrix <- matrix(nrow = 1, ncol = 5)
select_matrix[1, ] <- c(0.25, 1.0, 1 + 0.5 * s, 1 + s, 0)
markers <- seq(from = 0.2, to = 0.3, length.out = 100)
selected_pop <- simulate_admixture(
module = ancestry_module(number_of_founders = 10,
morgan = 1,
markers = markers),
pop_size = 1000,
total_runtime = 11,
select_matrix = select_matrix)
require(ggplot2)
plot_joyplot_frequencies(frequencies = selected_pop$frequencies,
time_points = 0:11,
picked_ancestor = "ALL")
# joyplot frequencies returns a ggplot object, so we can
# add extra elements:
plot_joyplot_frequencies(frequencies = selected_pop$frequencies,
time_points = 0:11,
picked_ancestor = "ALL") +
ggplot2::xlab("Location") +
ggplot2::ylab("Generations")
[Package GenomeAdmixR version 2.1.7 Index]