For each configuration provided in the res_object_list, display what number of clusters appear for different values of the resolution parameters.

plot_k_resolution_corresp(
  res_object_list,
  res_object_names = NULL,
  colour_information = c("ecc", "freq_k"),
  given_height = 0.7,
  pt_size_range = c(1.5, 4)
)

Arguments

res_object_list

An object returned by the `get_resolution_importance` method.

res_object_names

Custom names that the user could assing to each configuration; if not specified, the plot will use the generated configuration names.

colour_information

String that specifies the information type that will be illustrated using gradient colour: either `freq_k` for the frequency of the number of clusters or `ecc` for the Element-Centric Consistency of the partitions obtained when the resolution is fixed.

given_height

Used for adjusting the vertical position of the boxplot; the value will be passed in the `width` argument of the `ggplot::position_dodge` method.

pt_size_range

Indicates the minimum and the maximum size a point on the plot can have.

Value

A ggplot2 object. Different shapes of points indicate different parameter configuration, while the color illustrates the frequency of the most common partition or the Element-Centric Consistency of the partitions. The frequency is calculated as the fraction between the number of total appearances of partitions with a specific number of clusters and resolution value and the number of runs. The size illustrates the frequency of the most common partition with *k* clusters relative to the partitions obtained with the same resolution value and have *k* clusters.

Examples

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

# get the PCA embedding of the data
pca_embedding = irlba::irlba(expr_matrix, nv = 2)
pca_embedding = pca_embedding$u %*% diag(pca_embedding$d)
rownames(pca_embedding) = as.character(1:500)

# run the function on the pca embedding
resolution_result = get_resolution_importance(embedding = pca_embedding,
   resolution = c(0.8, 1),
   n_neigh = c(5, 7),
   n_repetitions = 5,
   clustering_method = 1,
   graph_type = 2,
   object_name = "name_example")

plot_k_resolution_corresp(resolution_result)