ggped: Draw pedigrees using ggplot2
Installation
if (!requireNamespace("remotes", quietly = TRUE)){
install.packages("remotes")
}
remotes::install_github("moritzlindner/ggped")
Description
This Package contains a set of functions and geoms to draw pedigree charts from pedigree data created with kinship2.
Examples
require(kinship2)
require(ggped)
data(minnbreast)
bpeds <- with(minnbreast,
pedigree(id, fatherid, motherid, sex, affected=proband, famid=famid))
#' #### pedigree with id=8
bped.id8 <- bpeds['8']
#' #### convert into ggplot-compatible data frame
df<-dfalign.pedigree(bped.id8)
## Did not include the following subject: 160 164 167 168 169 170 171 172 173 174 .
## Reason: No evidence for relation to other subjects in the tree.
#' #### draw plot on a cartesian coordinate system
cartesian<-ggdraw.pedigree(dat=df,features = c("affected"))
cartesian
#' #### draw plot on a polar coordinate system
cartesian+
scale_x_continuous(expand=expansion(add = 0.25))+
scale_y_reverse(expand=expansion(add = 1))+
coord_polar()