showInTriangle | R Documentation |
Utility function for plotting kappa coefficients in the IBD triangle. This
was previously only implemented as a base R plot, but is now also available
in ggplot2
and plotly
formats, controlled by the argument plotType
.
Labels are often easier to read in the two latter versions: The ggplot2
version uses ggrepel
to separate labels, while plotly
enables interactive
exploration of the plot.
showInTriangle(
kappa,
plotType = c("base", "ggplot2", "plotly"),
new = TRUE,
ped = NULL,
pedBL = c(0.5, 0.5),
pedArgs = NULL,
col = 6,
cex = 1,
pch = 4,
lwd = 2,
jitter = NULL,
labels = NULL,
colLab = col,
cexLab = 0.8,
labSep = "-",
pos = 1,
adj = NULL,
keep.par = TRUE,
...
)
kappa |
Coordinates of points to be plotted in the IBD triangle. Valid input types are:
|
plotType |
Either "base" (default), "ggplot2" or "plotly". Abbreviations are allowed. |
new |
A logical indicating if a new triangle should be drawn. |
ped |
A pedigree to be drawn in the upper right corner of the plot.
Default: NULL. This only works when |
pedBL |
A vector of length two, with entries in |
pedArgs |
Plotting arguments for the inset pedigree. Default: NULL. |
col , cex , pch , lwd |
Parameters controlling the appearance of points. |
jitter |
A logical. If NULL (default), jittering is disabled for
|
labels |
A character of same length as the number of points, or a single
logical |
colLab , cexLab , pos , adj |
Parameters controlling the appearance of labels.
Ignored when |
labSep |
A string, by default "-". |
keep.par |
A logical. If TRUE (and |
... |
Plot arguments passed on to |
If plotType = 'base'
, the function returns NULL; otherwise the plot
object.
ibdTriangle()
, kappaIBD()
showInTriangle(c(3/8, 1/8), label = "3/4 siblings", pos = 1)
# With inset pedigree
x = doubleCousins(1, 0, half2 = TRUE)
showInTriangle(c(3/8, 1/8), label = "3/4 siblings", pos = 1,
ped = x, pedArgs = list(hatched = 6:7))
# All pairs
k = kappaIBD(x)
showInTriangle(k, labels = TRUE, pos = 1:4, ped = x)
# With jitter and variable colors
showInTriangle(k, labels = TRUE, pos = 1:4, jitter = TRUE, col = 1:7, ped = x)
# Separate labels (requires ggplot2 + ggrepel)
# showInTriangle(k, plot = "ggplot2", col = 2:8, ped = x)
# Interactive plot (requires plotly)
# showInTriangle(k, plot = "plotly", col = 2:8, pch = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.