# NOT RUN {
##################
# Basic examples #
##################
# Simples use: Just give a list of ped objects.
peds = list(nuclearPed(3), cousinPed(2), singleton(12), halfSibPed())
plotPedList(peds, newdev = TRUE)
# Modify the relative widths (which are not guessed)
w = c(2, 3, 1, 2)
plotPedList(peds, widths = w)
# In most cases the guessed dimensions are ok but not perfect.
# Resize plot window manually and re-plot with `newdev = FALSE` (default)
# plotPedList(peds, widths = w)
## Remove frames
plotPedList(peds, widths = w, frames = FALSE)
# Non-default grouping
plotPedList(peds, widths = w, groups = list(1, 2:3), titles = 1:2)
# Parameters added in the main call are used in each sub-plot
plotPedList(peds, widths = w, margins = c(2, 4, 2, 4), labs = leaves,
hatched = leaves, symbolsize = 1.3, col = list(red = 1))
dev.off()
#################################
# Example of automatic grouping #
#################################
H1 = nuclearPed()
H2 = list(singleton(1), singleton(3)) # grouped!
plotPedList(list(H1, H2), dev.height = 2, dev.width = 4,
titles = c(expression(H[1]), expression(H[2])))
dev.off()
############################################################
# Complex example with individual parameters for each plot #
############################################################
# 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, `11` = "A/A", `12` = "A/A")
marg2 = c(3, 4, 2, 4)
plot2 = list(x2, marker = m2, margins = marg2, title = "Plot 2",
symbolsize = 1.2, labs = 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()
hatched = 4:5
col = list(red = founders(x4), blue = leaves(x4))
marg4 = marg1
plot4 = list(x4, margins = marg4, title = "Plot 4", cex = 1.3,
hatched = hatched, col = col)
plotPedList(list(plot1, plot2, plot3, plot4), widths = c(2,3,1,2),
groups = list(1, 2:3, 4), newdev = TRUE)
dev.off()
################################
# Example with large pedigrees #
################################
# Important to set device dimensions here
plotPedList(list(halfCousinPed(4), cousinPed(7)),
titles = c("Large", "Very large"),
dev.height = 8, dev.width = 5)
dev.off()
# }
Run the code above in your browser using DataLab