
This function creates a row of pedigree plots, each created by plot.ped()
.
Any parameter accepted by plot.ped()
can be applied, either to all plots
simultaneously, or to individual plots. Some effort is made to guess a
reasonable window size and margins, but in general the user must be prepared
to do manual resizing of the plot window. See various examples in the
Examples section below.
plotPedList(
plot.arg.list,
widths = NA,
frames = T,
frametitles = NULL,
fmar = NA,
newdev = F,
dev.height = NA,
dev.width = NA,
...
)
A list of lists. Each element of plot.arg.list
is a
list, where the first element is the ped()
object to be plotted, and the
remaining elements are passed on to plot.ped
. These elements must be
correctly named. See examples below.
A numeric vector of relative widths of the subplots. Recycled
to length(plot.arg.list)
if necessary, before passed on to layout()
.
Note that the vector does not need to sum to 1.
Either a single logical (FALSE = no frames; TRUE = automatic
framing) or a list of numeric vectors: Each vector must consist of
consecutive integers, indicating subplots to be framed together. By default
the framing follows the list structure of plot.arg.list
.
A character vector of titles for each frame. If this is non-NULL, titles for individuals subplots are ignored.
A single number in the interval
A logical, indicating if a new plot window should be opened.
The dimensions of the new device (only relevant
if newdev
is TRUE). If these are NA suitable values are guessed from the
pedigree sizes.
Further arguments passed on to each call to plot.ped()
.
Note that for tweaking dev.height and dev.width the function dev.size()
is
useful to determine the size of the active device.
# NOT RUN {
# Simplest use: Just give a list of ped objects.
# To guess suitable plot window dimensions, use 'newdev = TRUE'
peds = list(nuclearPed(3), cousinPed(2), singleton(12), halfSibPed())
plotPedList(peds, newdev = TRUE)
# Modify the relative widths (which are not guessed)
widths = c(2, 3, 1, 2)
plotPedList(peds, widths = widths)
# In most cases the guessed dimensions are ok but not perfect.
# Resize plot window manually, and then plot again with `newdev = F` (default)
# plotPedList(peds, widths = widths)
## Remove frames
plotPedList(peds, widths = widths, frames = FALSE)
# Non-default frames
frames = list(1, 2:3)
plotPedList(peds, widths = widths, frames = frames,
frametitles = c('First', 'Second'))
# To give *the same* parameter to all plots, it can just be added at the end:
margins = c(2, 4, 2, 4)
title = 'Same title'
id.labels = ''
symbolsize = 1.5
plotPedList(peds, widths = widths, frames = frames, margins = margins,
title = title, id.labels = id.labels, symbolsize = symbolsize,
newdev = TRUE)
# COMPLEX EXAMPLE WITH MARKER DATA AND VARIOUS OPTIONS
# For more control of individual plots, each plot and all its parameters
# can be specified in its own list:
x1 = nuclearPed(nch = 3)
m1 = marker(x1, `3` = 1:2)
marg1 = c(7, 4, 7, 4)
plot1 = list(x1, marker = m1, margins = marg1, title = "Plot 1",
deceased = 1:2, cex = 1.3)
x2 = cousinPed(2)
m2 = marker(x2, alleles = "A")
genotype(m2, leaves(x2)) = "A"
marg2 = c(3, 4, 2, 4)
plot2 = list(x2, marker = m2, margins = marg2, title = "Plot 2", symbolsize = 1.2,
skip.empty.genotypes = TRUE, id = NULL)
x3 = singleton("Mr. X")
marg3 = c(10, 0, 0, 0)
plot3 = list(x3, margins = marg3, title = "Plot 3", symbolsize = 1, cex = 2)
x4 = halfSibPed()
shaded = 4:5
col = c("black", "black", "black", "blue", "blue")
marg4 = marg1
plot4 = list(x4, margins = marg4, title = "Plot 4", shaded = shaded, col = col)
plotPedList(list(plot1, plot2, plot3, plot4), widths = c(2,3,1,2),
frames = list(1, 2:3, 4), newdev = TRUE)
# Different example:
plotPedList(list(halfCousinPed(4), cousinPed(7)),
title = c('Many generations', 'Very many generations'),
newdev = TRUE, dev.height = 9, dev.width = 9)
# }
Run the code above in your browser using DataLab