Title: | Plot Posterior Assignment Values From a 'DAPC' Analysis |
---|---|
Description: | The package 'adegenet' calculates posterior population assignments, which can be plotted as a stacked bar chart. This package creates a 'ggplot2' version of this bar chart, facetted by population. |
Authors: | Zhian N. Kamvar [cre, aut], Niklaus J. Grunwald [ths] |
Maintainer: | Zhian N. Kamvar <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2024-11-06 02:55:54 UTC |
Source: | https://github.com/zkamvar/ggcompoplot |
This is useful for defining a color palette that can be used by population factors.
char2pal(x, pal = rainbow)
char2pal(x, pal = rainbow)
x |
a vector of identifiers to be used for colors. |
pal |
a color palette. Default is |
a named character vector of hexadecimal colors.
char2pal(LETTERS)
char2pal(LETTERS)
Plot posterior values from DAPC analysis in adegenet
ggcompoplot(da.object, gid, pal = rainbow, cols = 1)
ggcompoplot(da.object, gid, pal = rainbow, cols = 1)
da.object |
an object of class "dapc" |
gid |
an object of class "genind" |
pal |
a color palette |
cols |
the number of columns to display |
a ggplot object with each population stacked on top of each other.
library('adegenet') library('ggcompoplot') library('ggplot2') data(microbov) strata(microbov) <- data.frame(other(microbov)) dapc1 <- dapc(microbov, n.pca=20, n.da=15) setPop(microbov) <- ~breed compoplot(dapc1, lab="") # Adegenet compoplot # Showing per breed ggcompoplot(dapc1, microbov) + theme(axis.text.x = element_blank()) ## Not run: # 3 columns ggcompoplot(dapc1, microbov, col = 3) + theme(axis.text.x = element_blank()) # Different color palette ggcompoplot(dapc1, microbov, col = 3, pal = funky) + theme(axis.text.x = element_blank()) # Per Country setPop(microbov) <- ~coun ggcompoplot(dapc1, microbov) + theme(axis.text.x = element_blank()) ## End(Not run)
library('adegenet') library('ggcompoplot') library('ggplot2') data(microbov) strata(microbov) <- data.frame(other(microbov)) dapc1 <- dapc(microbov, n.pca=20, n.da=15) setPop(microbov) <- ~breed compoplot(dapc1, lab="") # Adegenet compoplot # Showing per breed ggcompoplot(dapc1, microbov) + theme(axis.text.x = element_blank()) ## Not run: # 3 columns ggcompoplot(dapc1, microbov, col = 3) + theme(axis.text.x = element_blank()) # Different color palette ggcompoplot(dapc1, microbov, col = 3, pal = funky) + theme(axis.text.x = element_blank()) # Per Country setPop(microbov) <- ~coun ggcompoplot(dapc1, microbov) + theme(axis.text.x = element_blank()) ## End(Not run)