Package 'ggcompoplot'

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-12-06 03:09:58 UTC
Source: https://github.com/zkamvar/ggcompoplot

Help Index


Creates a named color palette.

Description

This is useful for defining a color palette that can be used by population factors.

Usage

char2pal(x, pal = rainbow)

Arguments

x

a vector of identifiers to be used for colors.

pal

a color palette. Default is rainbow

Value

a named character vector of hexadecimal colors.

Examples

char2pal(LETTERS)

Plot posterior values from DAPC analysis in adegenet

Description

Plot posterior values from DAPC analysis in adegenet

Usage

ggcompoplot(da.object, gid, pal = rainbow, cols = 1)

Arguments

da.object

an object of class "dapc"

gid

an object of class "genind"

pal

a color palette

cols

the number of columns to display

Value

a ggplot object with each population stacked on top of each other.

Examples

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)