autoplot_q_matrix | R Documentation |
q_matrix
objectsThis autoplot will automatically rearrange individuals according to their id
and any grouping variables if an associated 'data' gen_tibble is provided. To
avoid any automatic re-sorting of individuals, set arrange_by_group
and
arrange_by_indiv
to FALSE.
## S3 method for class 'q_matrix'
autoplot(
object,
data = NULL,
annotate_group = TRUE,
arrange_by_group = TRUE,
arrange_by_indiv = TRUE,
reorder_within_groups = FALSE,
...
)
object |
A Q matrix object (as returned by |
data |
An associated tibble (e.g. a |
annotate_group |
Boolean determining whether to annotate the plot with the group information |
arrange_by_group |
Boolean determining whether to arrange the
individuals by group. If the grouping variable in the |
arrange_by_indiv |
Boolean determining whether to arrange the
individuals by their individual id (if arrange_by_group is TRUE, they will
be arranged by group first and then by individual id, i.e. within each
group). If |
reorder_within_groups |
Boolean determining whether to reorder the
individuals within each group based on their ancestry proportion (note that
this is not advised if you are making multiple plots, as you would get a
different order for each plot!). If TRUE, |
... |
not currently used. |
a barplot of individuals, coloured by ancestry proportion
# Read example gt_admix obejct
admix_obj <-
readRDS(system.file("extdata", "anolis", "anole_adm_k3.rds",
package = "tidypopgen"
))
# Extract a Q matrix
q_mat_k3 <- get_q_matrix(admix_obj, k = 3, run = 1)
# Basic autoplot
autoplot(q_mat_k3, annotate_group = FALSE, arrange_by_group = FALSE)
# To arrange individuals by group and by Q proportion
autoplot(q_mat_k3,
annotate_group = TRUE, arrange_by_group = TRUE,
arrange_by_indiv = TRUE, reorder_within_groups = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.