jj_get_contour_lines: encirle fraction of points that contain x percent of the...

View source: R/jj_contour_lines.R

jj_get_contour_linesR Documentation

encirle fraction of points that contain x percent of the density mass

Description

estimate densities to include density area in tsne/umap. May fail for small datasets

Usage

jj_get_contour_lines(reduction_df, grouping_var, cont_thres)

Arguments

reduction_df

number of columns

grouping_var

number of rows

cont_thres

value to put into every cell

Examples

dr_df = data.frame(dim1 = c(rnorm(500, 3, 0.5), rnorm(200, 4, 0.1)),
                  dim2 = c(rnorm(500, 3, 0.5), rnorm(100, 4, 1), rnorm(100, 3.5, 1)),
                  group = rep(LETTERS[1:2], c(500,200)))
cont_l = jj_get_contour_lines(reduction_df = dr_df, grouping_var = 'group', cont_thres = 0.75)
gg = jj_plot_features(reduction = dr_df, meta_features = 'group', return_gg_object = T)
gg[[1]] + geom_path(data = cont_l,
                   aes(x=x, y=y, group=cont_group, linetype=group, colour=group),
                   size=1) + 
 labs(linetype='')

mathosi/jj documentation built on Feb. 25, 2024, 2:29 p.m.