Learn R Programming

STDistance (version 0.6.6)

plot_distance_boxplot: Visualize Nearest Neighbor Distances with Boxplot and Mean ± SEM

Description

Creates a boxplot visualization of distance metrics with overlaid mean points and SEM error bars. Suitable for comparing multiple groups with potentially skewed distributions.

Usage

plot_distance_boxplot(
  distance_result,
  id_col = "barcode",
  show_points = FALSE,
  y_scale = c("original", "log10"),
  palette = "Set2"
)

Value

A ggplot2 object. Additional customization can be done using ggplot2 functions.

Arguments

distance_result

A data.frame generated by calculate_nearest_distances(), containing distance measurements with columns: id_col + target_types.

id_col

Name of the column containing cell IDs (default: "barcode").

show_points

Logical, whether to overlay individual data points (default: FALSE).

y_scale

Method for y-axis scaling: "original" or "log10" (default: "original").

palette

Color palette name from RColorBrewer (default: "Set2").

Examples

Run this code
plot_distance_boxplot(distance_results,id_col = "Newbarcode")

Run the code above in your browser using DataLab