View source: R/ggdraw.pedigree.R
ggdraw.pedigree | R Documentation |
This function generates a pedigree plot using ggplot2.
ggdraw.pedigree(
dat = NULL,
features = c("affected"),
features.as.lables = NULL,
plot.names = T,
plot.kinship.label = T,
column.names = list(x = "x", y = "y", Name = "Name", mate.id = "mate.id", twin.id =
"twin.id", mate.centerpoint = "mate.centerpoint", family.centerpoint =
"family.centerpoint", twin.centerpoint = "twin.centerpoint", sex = "sex", adopted =
"adopted", pregnancy = "pregnancy"),
col.palette = suppressWarnings(brewer.pal(length(unique(dat[, features.as.lables])),
"Set2")),
col.lables = c(`wt/wt` = "black", wt = "black", `+/+` = "black", `wt/mut` =
col.palette[1], het = col.palette[1], `+/-` = col.palette[1], `mut/mut` =
col.palette[2], hom = col.palette[2], `-/-` = col.palette[2]),
col.tree = "#000000",
col.double = "#808080",
chrtype = "autosome",
packed = TRUE,
align = TRUE,
width = 10,
allow.repeated = F,
...
)
dat |
A pedigree object as returned by pedigree or data frame in the format as returned by dfalign.pedigree. |
features |
Names of columns containing binary features (e.g. affected status) in dat. |
features.as.lables |
Names of columns containing nominal features for plotting as labels under the subject's name. |
plot.names |
Whether to plot names of subjects or not. Requires a defined column in dat containing names. |
plot.kinship.label |
Whether to calculate and plot degree of kinship for inbred matings. |
column.names |
If dat is a data frame, then column name definitions. Standard are those created by dfalign.pedigree. adopted and pregancy are additional optional logical columns. |
col.palette |
Palette to use for text features. |
col.lables |
Font colour for subject labels. Per default, sets *wt* to black, *het* to first colour of palette and *hom* to the second colour of the palette. Accepts any arguments that is understood by the parameter *values* of scale_colour_manual. |
col.tree |
Line colour for tree. |
col.double |
Line colour for lines between repeatedly plotted subjects. |
chrtype |
chromosome type. The currently supported types are "autosome" and "X" or "x". |
packed |
should the pedigree be compressed, i.e., to allow diagonal lines connecting parents to children in order to have a smaller overall width for the plot. |
align |
for a packed pedigree, align children under parents (TRUE), to the extent possible given the page width, or align to to the left margin (FALSE). The latter is mostly used by internal routines. |
width |
for a packed output, the minimum width |
allow.repeated |
Allow drawing pedigress where subjects need to appear multiple times. This currently usually results in faulty pedigrees. |
... |
Further arguments passed to geom_pedigreepoint. |
A ggplot object containing the pedigree
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)
cartesian<-ggdraw.pedigree(dat=df,features = c("affected"))
cartesian+
scale_x_continuous(expand=expansion(add = 0.25))+
scale_y_reverse(expand=expansion(add = 1))+
coord_polar()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.