vis_gene_p | R Documentation |
This function visualizes the gene expression stored in assays(spe)
or any
continuous variable stored in colData(spe)
for one given sample at the
spot-level using (by default) the histology information on the background.
This is the function that does all the plotting behind vis_gene()
To visualize clusters (or any discrete variable) use vis_clus_p()
.
vis_gene_p(
spe,
d,
sampleid = unique(spe$sample_id)[1],
spatial,
title,
viridis = TRUE,
image_id = "lowres",
alpha = NA,
cont_colors = if (viridis) viridisLite::viridis(21) else c("aquamarine4",
"springgreen", "goldenrod", "red"),
point_size = 2,
auto_crop = TRUE,
na_color = "#CCCCCC40",
legend_title = ""
)
spe |
A
SpatialExperiment-class
object. See |
d |
A |
sampleid |
A |
spatial |
A |
title |
The title for the plot. |
viridis |
A |
image_id |
A |
alpha |
A |
cont_colors |
A |
point_size |
A |
auto_crop |
A |
na_color |
A |
legend_title |
A |
A ggplot2 object.
Other Spatial gene visualization functions:
vis_gene()
,
vis_grid_gene()
if (enough_ram()) {
## Obtain the necessary data
if (!exists("spe")) spe <- fetch_data("spe")
## Prepare the data for the plotting function
spe_sub <- spe[, spe$sample_id == "151673"]
df <- as.data.frame(cbind(colData(spe_sub), SpatialExperiment::spatialCoords(spe_sub)), optional = TRUE)
df$COUNT <- df$expr_chrM_ratio
## Don't plot the histology information
p <- vis_gene_p(
spe = spe_sub,
d = df,
sampleid = "151673",
title = "151673 chrM expr ratio",
spatial = FALSE
)
print(p)
## Clean up
rm(spe_sub)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.