View source: R/heat_tree_matrix.R
heat_tree_matrix | R Documentation |
Plot a matrix of heat trees for showing pairwise comparisons. A larger,
labelled tree serves as a key for the matrix of smaller unlabelled trees. The
data for this function is typically created with compare_groups
,
heat_tree_matrix(
obj,
data,
label_small_trees = FALSE,
key_size = 0.6,
seed = 1,
output_file = NULL,
row_label_color = diverging_palette()[3],
col_label_color = diverging_palette()[1],
row_label_size = 12,
col_label_size = 12,
...,
dataset = NULL
)
obj |
A |
data |
The name of a table in |
label_small_trees |
If |
key_size |
The size of the key tree relative to the whole graph. For example, 0.5 means half the width/height of the graph. |
seed |
That random seed used to make the graphs. |
output_file |
The path to one or more files to save the plot in using |
row_label_color |
The color of the row labels on the right side of the matrix. Default: based on the node_color_range. |
col_label_color |
The color of the columns labels along the top of the matrix. Default: based on the node_color_range. |
row_label_size |
The size of the row labels on the right side of the matrix. Default: 12. |
col_label_size |
The size of the columns labels along the top of the matrix. Default: 12. |
... |
Passed to |
dataset |
DEPRECIATED. use "data" instead. |
## Not run:
# Parse dataset for plotting
x <- parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
class_key = c(tax_rank = "taxon_rank", tax_name = "taxon_name"),
class_regex = "^(.+)__(.+)$")
# Convert counts to proportions
x$data$otu_table <- calc_obs_props(x, data = "tax_data", cols = hmp_samples$sample_id)
# Get per-taxon counts
x$data$tax_table <- calc_taxon_abund(x, data = "otu_table", cols = hmp_samples$sample_id)
# Calculate difference between treatments
x$data$diff_table <- compare_groups(x, data = "tax_table",
cols = hmp_samples$sample_id,
groups = hmp_samples$body_site)
# Plot results (might take a few minutes)
heat_tree_matrix(x,
data = "diff_table",
node_size = n_obs,
node_label = taxon_names,
node_color = log2_median_ratio,
node_color_range = diverging_palette(),
node_color_trans = "linear",
node_color_interval = c(-3, 3),
edge_color_interval = c(-3, 3),
node_size_axis_label = "Number of OTUs",
node_color_axis_label = "Log2 ratio median proportions")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.