make_point_hull | R Documentation |
Make alpha hull from points
make_point_hull(
x,
expand = 0.1,
buffer = NULL,
alpha = NULL,
seed = 123,
col = "#FF000033",
border = "#FF0000FF",
lwd = 2,
lty = 1,
max_iterations = 100,
do_plot = FALSE,
add = FALSE,
hull_method = c("default", "alphahull", "igraph", "sf", "chull"),
smooth = TRUE,
shape = 1/2,
label = NULL,
label.cex = 1,
label.x.nudge = 0,
label.y.nudge = 0,
label_preset = NULL,
label_adj_preset = label_preset,
verbose = FALSE,
...
)
x |
|
expand |
|
buffer |
|
alpha |
|
seed |
|
lwd , lty |
line width and line type parameters, respectively. |
max_iterations |
|
do_plot |
|
add |
|
hull_method |
|
smooth |
|
label_preset |
|
label_adj_preset |
|
verbose |
|
... |
additional arguments are ignored. |
color , border |
|
This function makes an alpha hull around points, calling
alphahull::ashape()
then piecing together the somewhat
random set of outer edges into a coherent polygon.
numeric
matrix with polygon coordinates, where
each polygon is separated by one row that contains NA
values. This output is sufficient for vectorized plotting
in base R graphics using graphics::polygon()
.
Other jam utility functions:
avg_angles()
,
avg_colors_by_list()
,
call_fn_ellipsis_deprecated()
,
cell_fun_bivariate()
,
collapse_mem_clusters()
,
colorRamp2D()
,
deconcat_df2()
,
display_colorRamp2D()
,
enrichList2geneHitList()
,
filter_mem_genes()
,
filter_mem_sets()
,
find_colname()
,
get_hull_data()
,
get_igraph_layout()
,
gsubs_remove()
,
handle_igraph_param_list()
,
isColorBlank()
,
make_legend_bivariate()
,
mem_find_overlap()
,
order_colors()
,
rank_mem_clusters()
,
rotate_coordinates()
,
subgraph_jam()
,
subset_mem()
,
summarize_node_spacing()
,
xyAngle()
set.seed(12)
n <- 22
xy <- cbind(x=sample(seq_len(n), size=n, replace=TRUE),
y=sample(seq_len(n), size=n, replace=TRUE));
xy <- rbind(xy, xy[1,,drop=FALSE])
x4 <- sf::st_multipoint(xy)
if (jamba::check_pkg_installed("alphahull")) {
plot(x4, col="red", pch=20, cex=3,
main="hull_method='alphahull'")
phxy <- make_point_hull(x=xy, expand=0.05, do_plot=TRUE,
hull_method="alphahull",
label="alphahull",
add=TRUE, xpd=TRUE)
}
plot(x4, col="red", pch=20, cex=3,
main="hull_method='chull'")
phxy2 <- make_point_hull(x=xy, expand=0.05, do_plot=TRUE,
add=TRUE, verbose=TRUE, xpd=TRUE, hull_method="chull")
plot(x4, col="red", pch=20, cex=3,
main="hull_method='igraph'")
phxy2 <- make_point_hull(x=xy, expand=0.05, do_plot=TRUE,
add=TRUE, verbose=TRUE, xpd=TRUE, hull_method="igraph")
plot(x4, col="red", pch=20, cex=3,
main="hull_method='sf'")
phxy2 <- make_point_hull(x=xy, expand=0.05, do_plot=TRUE,
add=TRUE, verbose=TRUE, xpd=TRUE, hull_method="sf")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.