ts_draw | R Documentation |
This function first obtains an SVG representation of the tree by calling the
draw_svg
method of tskit and renders it as a bitmap image in R. All of
the many optional keyword arguments of the draw_svg
method can be
provided and will be automatically passed to the method behind the scenes.
ts_draw(
x,
width = 1000,
height = 1000,
labels = FALSE,
sampled_only = TRUE,
title = NULL,
...
)
x |
A single tree extracted by |
width , height |
Pixel dimensions of the rendered bitmap |
labels |
Label each node with the individual name? |
sampled_only |
Should only individuals explicitly sampled through simplification be labeled? This is relevant in situations in which sampled individuals can themselves be among the ancestral nodes. |
title |
Optional title for the figure |
... |
Keyword arguments to the tskit |
No return value, called for side effects
init_env()
# load an example model with an already simulated tree sequence
slendr_ts <- system.file("extdata/models/introgression_slim.trees", package = "slendr")
model <- read_model(path = system.file("extdata/models/introgression", package = "slendr"))
# load the tree-sequence object from disk
ts <- ts_read(slendr_ts, model)
# extract the first tree in the tree sequence and draw it
tree <- ts_tree(ts, i = 1)
# ts_draw accepts various optional arguments of tskit.Tree.draw_svg
ts_draw(tree, time_scale = "rank")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.