Description Usage Arguments Details Value Side Effects See Also Examples
View source: R/plot.pedigree.R
plot objects created with the pedigree function
1 2 3 4 5 6 7 8 | ## S3 method for class 'pedigree'
plot(x, id = x$id, status = x$status, affected =
x$affected, age = NULL, number = NULL, cex = 1, col = 1,
dist_text = 1.5, symbolsize = 1, branch = 0.6,
packed = TRUE, align = c(1.5,2), width = 8, height = 4,
density = -1, mar = c(4.1, 1, 4.1, 1), angle = 45,
keep.par = FALSE, subregion, pconnect= .5,
consultand = NULL, info = NULL, adopted = NULL, ...)
|
x |
object created by the function pedigree. |
id |
id variable. |
status |
can be missing. If it exists, 0=alive/missing, 1=death and 2=pregnancy. |
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). If values 2 or 3 are present in a matrix row and all the other values of the matrix row are 0, a dot or a vertical line is drawn inside the symbol (carriers and presymptomatics). |
age |
vector of ages of the subjects in the plot as character strings. |
number |
vector of number of subjects represented by every symbol. Possible values: 1, 2, 3, 4, 5, 6, 7, 8, 9 or "n" (unknown number). |
cex |
controls text size. Default=1. |
col |
color for each affected column. Default=1. |
dist_text |
distance between the symbols and the text below them. Default=1.5 |
symbolsize |
controls symbolsize. Default=1. |
branch |
defines how much angle is used to connect various levels of nuclear families. Default=0.6. |
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. |
height |
default=4. Height of the plot. |
density |
defines density used in the symbols for every affected column. Default=-1. |
mar |
margin parmeters, as in the |
angle |
defines angle used in the symbols for every affected column. Default=45. |
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 |
pconnect |
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 |
consultand |
id of the consultand subjects. |
info |
matrix where every column is a field of information in the form of character strings. |
adopted |
vector that contains adoption information for every subject. Values can be: "in" (adopted inside the family), "out" (adopted outside the family) or NA (not adopted). |
... |
Extra options that feed into the plot function |
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)∑{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 *(x1-x2)^2, which tends to keep them together. The size of $b$ controls the relative importance of sib-parent and spouse-spouse closeness.
an invisible list containing
plist |
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. |
x,y |
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.) |
boxh |
the height of the symbol, in user coordinates |
boxw |
the width of the symbol |
call |
a copy of the call that generated the plot |
creates plot on current plotting device.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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)
## Not run:
plot(ped2)
legendPlot(ped2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.