vis_clus | R Documentation |
This function visualizes the clusters for one given sample at the spot-level
using (by default) the histology information on the background. To visualize
gene-level (or any continuous variable) use vis_gene()
.
vis_clus(
spe,
sampleid = unique(spe$sample_id)[1],
clustervar,
colors = c("#b2df8a", "#e41a1c", "#377eb8", "#4daf4a", "#ff7f00", "gold", "#a65628",
"#999999", "black", "grey", "white", "purple"),
spatial = TRUE,
image_id = "lowres",
alpha = NA,
point_size = 2,
auto_crop = TRUE,
na_color = "#CCCCCC40",
is_stitched = FALSE,
...
)
spe |
A
SpatialExperiment-class
object. See |
sampleid |
A |
clustervar |
A |
colors |
A vector of colors to use for visualizing the clusters
from |
spatial |
A |
image_id |
A |
alpha |
A |
point_size |
A |
auto_crop |
A |
na_color |
A |
is_stitched |
A |
... |
Passed to paste0() for making the title of the
plot following the |
This function subsets spe
to the given sample and prepares the
data and title for vis_clus_p()
.
A ggplot2 object.
Other Spatial cluster visualization functions:
frame_limits()
,
vis_clus_p()
,
vis_grid_clus()
if (enough_ram()) {
## Obtain the necessary data
if (!exists("spe")) spe <- fetch_data("spe")
## Check the colors defined by Lukas M Weber
libd_layer_colors
## Use the manual color palette by Lukas M Weber
p1 <- vis_clus(
spe = spe,
clustervar = "layer_guess_reordered",
sampleid = "151673",
colors = libd_layer_colors,
... = " LIBD Layers"
)
print(p1)
## Without auto-cropping the image
p2 <- vis_clus(
spe = spe,
clustervar = "layer_guess_reordered",
sampleid = "151673",
colors = libd_layer_colors,
auto_crop = FALSE,
... = " LIBD Layers"
)
print(p2)
## Without histology
p3 <- vis_clus(
spe = spe,
clustervar = "layer_guess_reordered",
sampleid = "151673",
colors = libd_layer_colors,
... = " LIBD Layers",
spatial = FALSE
)
print(p3)
## With some NA values
spe$tmp <- spe$layer_guess_reordered
spe$tmp[spe$sample_id == "151673"][seq_len(500)] <- NA
p4 <- vis_clus(
spe = spe,
clustervar = "tmp",
sampleid = "151673",
colors = libd_layer_colors,
na_color = "white",
... = " LIBD Layers"
)
print(p4)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.