display_hull | R Documentation |
Draw a hull around a region of interest of Visium data.
display_hull(
data = NULL,
ident = NULL,
size_x = 2.4,
size_y = 2,
step_x = 2.6,
step_y = 2.4,
delta = 0.3,
color = "white",
hull_type = c("walls", "ggforce"),
expand = unit(0.05, "mm"),
radius = unit(0.5, "mm"),
concavity = 1,
size = 0.7
)
data |
A Seurat spatial object (Visium technology) or a data.frame (spot coordinates). |
ident |
A binary vector whose length correspond to the number of columns/spots in the seurat object. 1 corresponds to the spots of the class of interest for which a hull is to be displayed |
size_x |
The size of the square (x axis) |
size_y |
The size of the square (y axis) |
step_x |
The distance between two points on the x axis. |
step_y |
The distance between two points on the y axis. |
delta |
Add more or less flexibility to search for neighbor points |
color |
A color for the hull. |
hull_type |
The method for drawing the hull: 'ggforce' (see ggforce::geom_mark_hull) or 'wall'. If wall, segment wont be connected but this will frequently allows to obtain a better delimited hull. |
expand |
For hull_type 'ggforce'. A numeric or unit vector of length one, specifying the expansion amount. |
radius |
For hull_type 'ggforce'. As expand but specifying the corner radius. |
concavity |
A measure of the concavity of the hull. 1 is very concave while it approaches convex as it grows. Defaults to 2. |
size |
The line width. |
A ggplot object (with segments).
library(Seurat)
load_example_dataset("7870305/files/lymph_node_tiny_2")
load_example_dataset("7870305/files/lymph_node_tiny_clusters_2")
lymph_node_tiny_2 <- Seurat::AddModuleScore(lymph_node_tiny_2, features = lymph_node_tiny_clusters_2@gene_clusters, nbin = 10)
p <- Seurat::SpatialDimPlot(lymph_node_tiny_2, pt.size.factor = 4)
p
hull <- display_hull(lymph_node_tiny_2,
ident=ifelse(Seurat::Idents(lymph_node_tiny_2) %in% c(7, 8), 1, 0),
delta=1, size_x=3.4, size_y=3)
p + hull
p <- plot_spatial(lymph_node_tiny_2, metadata = "Cluster3", pt_size = 5)
hull <- display_hull(lymph_node_tiny_2,
ident=ifelse(Seurat:: Idents(lymph_node_tiny_2) %in% c(7, 8), 1, 0),
delta=1, size_x=3.4, size_y=3, color="black")
p + hull
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.