Skip to contents

This function visualize triangular mesh with coloured long edges.

Usage

vis_lg_mesh(distance_edges, benchmark_value, tr_coord_df, distance_col)

Arguments

distance_edges

The tibble that contains the edge information.

benchmark_value

The threshold value to determine long edges.

tr_coord_df

A tibble that contains the x and y coordinates of start and end points.

distance_col

The column name in `distance_edges` representing the distances.

Value

A ggplot object with the triangular mesh plot where long edges are coloured differently.

Examples

r2 <- diff(range(s_curve_noise_umap$UMAP2))/diff(range(s_curve_noise_umap$UMAP1))
num_bins_x <- 4
hb_obj <- hex_binning(data = s_curve_noise_umap_scaled, bin1 = num_bins_x,
r2 = r2)
all_centroids_df <- hb_obj$centroids
counts_df <- hb_obj$std_cts
df_bin_centroids <- extract_hexbin_centroids(centroids_df = all_centroids_df,
counts_df = counts_df) |>
dplyr::filter(drop_empty == FALSE)
tr1_object <- tri_bin_centroids(hex_df = df_bin_centroids, x = "c_x", y = "c_y")
tr_from_to_df <- gen_edges(tri_object = tr1_object)
distance_df <- cal_2d_dist(tr_coord_df = tr_from_to_df, start_x = "x_from",
start_y = "y_from", end_x = "x_to", end_y = "y_to",
select_vars = c("from", "to", "distance"))
vis_lg_mesh(distance_edges = distance_df, benchmark_value = 0.75,
tr_coord_df = tr_from_to_df, distance_col = "distance")