Skip to contents

Visualises the output of test_resolution as a line plot of mean cells per community against resolution, with optional error bars. Use this plot to identify a resolution that yields communities of a suitable and stable size before running create_communities.

Usage

plot_resolution_results(resolution_results, show_error_bars = TRUE)

Arguments

resolution_results

A data.frame as returned by test_resolution, containing at minimum the columns resolution and mean_cells_per_community. If show_error_bars = TRUE, the column sd_cells_per_community must also be present.

show_error_bars

A logical value. If TRUE (the default), error bars showing ±1 SD (sd_cells_per_community) are added around each point.

Value

A ggplot object showing mean cells per community against resolution.

See also

test_resolution to generate the input data.frame; create_communities to assign cells to communities once a resolution has been chosen.

Examples

if (FALSE) { # \dontrun{
# Test a range of resolutions
res_results <- test_resolution(sce, resolutions = c(0.5, 1, 2.5, 5))

# Plot the results with error bars
plot_resolution_results(res_results)

# Plot without error bars
plot_resolution_results(res_results, show_error_bars = FALSE)
} # }