Display EC consistency across clustering method and resolution values. The `filtered` field of the object returned by the `get_clustering_difference_object` method is used. Above each boxplot, the number of clusters is displayed.

plot_clustering_difference_boxplot(
  clustering_difference_object,
  text_size = 3,
  dodge_width = 0.9,
  boxplot_width = 0.4
)

Arguments

clustering_difference_object

An object returned by the `get_clustering_difference_object` method.

text_size

The size of the labels above boxplots.

dodge_width

Used for adjusting the horizontal position of the boxplot; the value will be passed to the `width` argument of the `ggplot2::position_dodge` method.

boxplot_width

Used for adjusting the width of the boxplots; the value will be passed to the `width` argument of the `ggplot2::geom_boxplot` method.

Value

A ggplot2 object with the EC consistency distributions. Higher consistency indicates a more stable clustering.

Examples

set.seed(2021)
# create an artificial expression matrix
expr_matrix = matrix(runif(500*10), nrow = 500)
rownames(expr_matrix) = as.character(1:500)

adj_matrix = Seurat::FindNeighbors(expr_matrix,
    k.param = 10,
    nn.method = "rann",
    verbose = FALSE,
    compute.SNN = FALSE)$nn
clust_diff_obj = get_clustering_difference(graph_adjacency_matrix = adj_matrix,
    resolution = c(0.5, 1),
    n_repetitions = 10,
    algorithm = 1:2,
    verbose = FALSE)
plot_clustering_difference_boxplot(clust_diff_obj)