plot objects created with the pedigree function
# S3 method for 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,65,20), #mar=c(3.1, 1, 3.1, 1),
angle=c(90,65,40,0), keep.par=FALSE,
subregion, pconnect=.5, ...)
an invisible list containing
a list that contains all the position information for plotting the pedigree. This will useful for further functions (yet unwritten) for manipulating the plot, but likely not to an ordinary user.
the x an and y plot coordinates of each subject in the plot. The coordinate is for the top of the plotted symbol. These will be in the same order as the input pedigree. If someone in the pedigree does not appear in the plot their coordinates will be NA. If they appear multiple times one of the instances is chosen. (Which one is a function of the order in which the pedigree was constructed.)
the height of the symbol, in user coordinates
the width of the symbol
a copy of the call that generated the plot
object created by the function pedigree.
id variable - used for labeling.
can be missing. If it exists, 0=alive/missing and 1=death.
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)
controls text size. Default=1.
color for each id. Default assigns the same color to everyone.
controls symbolsize. Default=1.
defines how much angle is used to connect various levels of nuclear families.
default=T. If T, uniform distance between all individuals at a given level.
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.
default=8. For a packed pedigree, the minimum width allowed in the realignment of pedigrees.
defines density used in the symbols. Takes up to 4 different values.
margin parmeters, as in the par
function
defines angle used in the symbols. Takes up to 4 different values.
Default = F, allows user to keep the parameter settings the same as they were for plotting (useful for adding extras to the plot)
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
when connecting parent to children the program will try
to make the connecting line as close to vertical as possible, subject
to it lying inside the endpoints of the line that connects the
children by at least pconnect
people. Setting this option
to a large number will force the line to connect at the midpoint of
the children.
Extra options that feed into the plot function.
creates plot on current plotting device.
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 suggestion is 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$$
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.
pedigree
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