Learn R Programming

kinship2 (version 1.3.1)

plot.pedigree: plot pedigrees

Description

plot objects created with the pedigree function

Usage

## S3 method for class 'pedigree':
plot(x, id = x$id, status = x$status, affected =
                 x$affected, cex = 1, col = 1, symbolsize = 1, branch =
                 0.6, packed = TRUE, align = c(1.5,2), width = 8,
                 density = c(-1, 35, 55, 25), mar = c(4.1, 1, 4.1, 1),
                 angle = c(90, 65, 40, 0), keep.par = FALSE, subregion,
                 ...)

Arguments

x
object created by the function pedigree.
id
id variable - used for labeling.
status
can be missing. If it exists, 0=alive/missing and 1=death.
affected
vector, or matrix with up to 4 columns for affected indicators. Subject's symbol is divided into sections for each status, shaded if indicator is 1, not-shaded for 0, and symbol "?" if missing (NA)
cex
controls text size. Default=1.
col
color for each id. Default assigns the same color to everyone.
symbolsize
controls symbolsize. Default=1.
branch
defines how much angle is used to connect various levels of nuclear families.
packed
default=T. If T, uniform distance between all individuals at a given level.
align
these parameters control the extra effort spent trying to align children underneath parents, but without making the pedigree too wide. Set to F to speed up plotting.
width
default=8. For a packed pedigree, the minimum width allowed in the realignment of pedigrees.
density
defines density used in the symbols. Takes up to 4 different values.
mar
margin parmeters, as in the par function
angle
defines angle used in the symbols. Takes up to 4 different values.
keep.par
Default = F, allows user to keep the parameter settings the same as they were for plotting (useful for adding extras to the plot)
subregion
4-element vector for (min x, max x, min depth, max depth), used to edit away portions of the plot coordinates returned by align.pedigree
...
Extra options that feed into the plot function.

Value

  • returns points for each plot plus original pedigree.

Side Effects

creates plot on current plotting device.

Details

Two important parameters control the looks of the result. One is the user specified maximum width. The smallest possible width is the maximum number of subjects on a line, if the user's suggestionis too low it is increased to 1+ that amount (to give just a little wiggle room). To make a pedigree where all children are centered under parents simply make the width large enough, however, the symbols may get very small.

The second is align, a vector of 2 alignment parameters $a$ and $b$. For each set of siblings at a set of locations x and with parents at p=c(p1,p2) the alignment penalty is $$(1/k^a)\sum{i=1}{k} [(x_i - (p1+p2)/2)]^2$$ {sum(x- mean(p))^2/(k^a)} where k is the number of siblings in the set. when $a=1$ moving a sibship with $k$ sibs one unit to the left or right of optimal will incur the same cost as moving one with only 1 or two sibs out of place. If $a=0$ then large sibships are harder to move than small ones, with the default value $a=1.5$ they are slightly easier to move than small ones. The rationale for the default is as long as the parents are somewhere between the first and last siblings the result looks fairly good, so we are more flexible with the spacing of a large family. By tethering all the sibs to a single spot they are kept close to each other. The alignment penalty for spouses is $b(x_1 - x_2)^2$, which tends to keep them together. The size of $b$ controls the relative importance of sib-parent and spouse-spouse closeness.

See Also

pedigree

Examples

Run this code
data(sample.ped)

pedAll <- pedigree(sample.ped$id, sample.ped$father, sample.ped$mother, 
       sample.ped$sex,  #affected=sample.ped$affected,
       affected=cbind(sample.ped$affected, sample.ped$avail), 
       famid=sample.ped$ped)

ped2 <- pedAll['2']

print(ped2)


## plot(ped2)

Run the code above in your browser using DataLab