## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
    collapse = TRUE,
    message = FALSE,
    comment = "#>",
    # fig.width = 8,
    # fig.height = 8,
    fig.small = TRUE
)

## ----install_bioc, eval=FALSE-------------------------------------------------
#  if (!require("BiocManager", quietly = TRUE)) {
#      install.packages("BiocManager")
#  }
#  BiocManager::install("escheR")

## ----install_github, eval = FALSE---------------------------------------------
#  if (!require("devtools")) install.packages("devtools")
#  devtools::install_github("boyiguo1/escheR")

## ----setup--------------------------------------------------------------------
library(escheR)
library(STexampleData)
library(spatialLIBD)

## ----data.import--------------------------------------------------------------
spe <- Visium_humanDLPFC()

# Subset in-tissue spots
spe <- spe[, spe$in_tissue == 1]

## ----spe_summary--------------------------------------------------------------
spe

## ----create_plot--------------------------------------------------------------
p <- make_escheR(spe)

## ----creat_fill---------------------------------------------------------------
(p1 <- p |>
    add_fill(var = "cell_count"))

p1 +
    scale_fill_viridis_c()

## ----create_ground------------------------------------------------------------
(p2 <- p |>
    add_ground(var = "ground_truth")) # round layer

## ----add_symbol---------------------------------------------------------------
p2 |>
    add_symbol(var = "ground_truth", size = 0.2) # Symbol layer

## ----customize----------------------------------------------------------------
# Currated color pallette from spatialLIBD
spatialLIBD::libd_layer_colors

p2 +
    scale_color_manual(
        name = "", # No legend name
        values = spatialLIBD::libd_layer_colors
    ) +
    labs(title = "Example Title")

## -----------------------------------------------------------------------------
sessionInfo()