Bar plot of clonal diversity metrics
plot_diversity.Rd
The plot_diversity()
plots the requested clonal diversity metric
Usage
plot_diversity(
div,
metric = get_all_div_metrics(),
q = 2,
percent = 90,
group_col = NULL,
label_col = "Sample",
flip = FALSE,
facet = FALSE,
log_scale = FALSE,
samples = NULL,
return_data = FALSE,
color_scheme = NULL
)
Arguments
- div
a list created by the
diversity()
function with diversity metrics for each sample- metric
the diversity metric to use (e.g. shannon, simpson, etc.)
- q
(optional) for 'renyi' and 'hill' metrics, the order q of the diversity index
- percent
(optional) for 'dXX' metric, the percentage 'XX' between 0 and 100
- group_col
(optional) if supplied, a column of the metadata that will be used to group samples
- label_col
(optional) labels for the samples
- flip
(optional) if TRUE, flip the x and y-axes (default is FALSE)
- facet
(optional) if TRUE, plot with separate facets, or sub-plots for each group (default is FALSE)
- log_scale
(optional) if TRUE, use log-scale for the y-axis (default is FALSE)
- return_data
(optional) if TRUE, return the data used to make the plot (default is FALSE)
Value
A list with two objects:
$plot
- a ggplot object with the plot of the requested diversity metric
$data
- if return_data is TRUE, the data frame used to make the plot
Details
This function can plot a variety of clonal diversity metrics for a dataset (richness,
Simpson diversity index, Shannon-Wiener index, etc.). See get_all_div_metrics()
for
all available options. By default it return a barplot with one bar for each sample in
the dataset. If a grouping column (of the metadata) is supplied, then samples will be grouped and
bar heights will reflect the average diversity metric across the group, with error bars
showing the standard deviation.
See also
diversity()
, get_all_div_metrics()
Other plotting:
plot_clone_size_across_samples()
,
plot_clonotype_indices()
,
plot_clusters()
,
plot_n_reads()
,
plot_num_partners()
,
plot_paired()
,
plot_paired_by_read_fraction_range()
,
plot_paired_vs_rank()
,
plot_pairs_with_eachother()
,
plot_ranks()
,
plot_read_fraction_vs_pair_status()
,
plot_sample_overlap()
,
plot_sample_vs_sample()