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()
.
Defaults to the output of
fetch_data(type = 'spe')
. This is a
SpatialExperiment-class
object with the spot-level Visium data and information required for
visualizing the histology. See fetch_data()
for more details.
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 colData(spe)
column that has the cluster values.
A vector of colors to use for visualizing the clusters
from clustervar
. If the vector has names, then those should match the
values of clustervar
.
A logical(1)
indicating whether to include the histology
layer from geom_spatial()
. If you plan to use
ggplotly() then it's best to set this to FALSE
.
A character(1)
with the name of the image ID you want to
use in the background.
A numeric(1)
in the [0, 1]
range that specifies the
transparency level of the data on the spots.
A numeric(1)
specifying the size of the points. Defaults
to 1.25
. Some colors look better if you use 2
for instance.
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.
Passed to paste0() for making 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_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)
}
#> 2023-09-05 20:34:57.709554 loading file /github/home/.cache/R/BiocFileCache/152d33414640_Human_DLPFC_Visium_processedData_sce_scran_spatialLIBD.Rdata%3Fdl%3D1