This function visualizes the histology image for selected sample. Matches
crop and settings of vis_clus() and vis_gene().
vis_image(
spe,
sampleid = unique(spe$sample_id)[1],
image_id = "lowres",
auto_crop = TRUE,
is_stitched = FALSE,
title_suffix = NULL
)A
SpatialExperiment-class
object. See fetch_data() for how to download some example objects or
read10xVisiumWrapper() to read in spaceranger --count output files and
build your own spe object.
A character(1) specifying which sample to plot from
colData(spe)$sample_id (formerly colData(spe)$sample_name).
A character(1) with the name of the image ID you want to
use in the background.
A logical(1) indicating whether to automatically crop
the image / plotting area, which is useful if the Visium capture area is
not centered on the image and if the image is not a square.
A logical(1) vector: If TRUE, expects a
SpatialExperiment-class built
with visiumStitched::build_spe().
http://research.libd.org/visiumStitched/reference/build_spe.html; in
particular, expects a logical colData column exclude_overlapping
specifying which spots to exclude from the plot. Sets auto_crop = FALSE.
A character(1) passed to paste() to
modify the title of the plot following the sampleid.
A ggplot2 object.
This function subsets spe to the given sample and prepares the
data and title for vis_clus_p().
Other Spatial cluster visualization functions:
frame_limits(),
vis_clus(),
vis_clus_p(),
vis_grid_clus()
if (enough_ram()) {
## Obtain the necessary data
if (!exists("spe")) spe <- fetch_data("spe")
## Print the "lowres" image for sample 151673
p1 <- vis_image(
spe = spe,
sampleid = "151673"
)
print(p1)
## Without auto-cropping the image
p2 <- vis_image(
spe = spe,
sampleid = "151673",
auto_crop = FALSE
)
print(p2)
}
#> 2025-09-17 01:20:42.761109 loading file /github/home/.cache/R/BiocFileCache/22ac1bc3fd2d_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1