% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/panoramic-visualization.R
\name{plot_spatial_network}
\alias{plot_spatial_network}
\title{Plot PANORAMIC spatial colocalization network}
\usage{
plot_spatial_network(
  se_diff,
  fdr_threshold = 0.05,
  leiden_resolution = 1,
  z_sign = c("both", "positive", "negative"),
  include_nonsig = FALSE,
  nonsig_max_fdr = 1,
  directed = FALSE,
  sig_operator = c("lt", "gt"),
  layout = "fr",
  node_size_by = "degree",
  label_repel = TRUE,
  label_box_padding = 0.2,
  label_point_padding = 0.1,
  label_force = 0.8,
  return_net = FALSE
)
}
\arguments{
\item{se_diff}{A SummarizedExperiment returned by
\code{panoramic_meta_mv()}.}

\item{fdr_threshold}{Numeric threshold used for significance and
edge classification.}

\item{leiden_resolution}{Numeric Leiden resolution passed to
\code{create_spatial_network()}.}

\item{z_sign}{Character sign filter for \code{z_diff}
(\code{"both"}, \code{"positive"}, \code{"negative"}).}

\item{include_nonsig}{Logical; include non-significant edges.}

\item{nonsig_max_fdr}{Numeric max FDR retained when
\code{include_nonsig = TRUE}.}

\item{directed}{Logical; pass through to \code{create_spatial_network()}.}

\item{sig_operator}{One of \code{"lt"} or \code{"gt"} passed through to
\code{create_spatial_network()} for threshold direction.}

\item{layout}{Character string specifying the graph layout passed to
ggraph (e.g. "fr", "kk", "stress"). Default "fr".}

\item{node_size_by}{Character name of a vertex attribute used to scale
node sizes (e.g. "degree", "strength", "betweenness").
Default "degree".}

\item{label_repel}{Logical; if TRUE use repelled node labels.}

\item{label_box_padding}{Numeric box padding for repelled labels.}

\item{label_point_padding}{Numeric point padding for repelled labels.}

\item{label_force}{Numeric repulsion force for labels.}

\item{return_net}{Logical; if TRUE return a list with
\code{plot} and \code{net}.}
}
\value{
A ggplot object by default, or a list with \code{plot} and
\code{net} when \code{return_net = TRUE}.
}
\description{
Wrapper to construct and visualize a PANORAMIC spatial colocalization network.
It builds the directed network via \code{create_spatial_network()} and
then renders it with ggraph/tidygraph.
}
\examples{
se_diff <- SummarizedExperiment::SummarizedExperiment(
  assays = list(dummy = matrix(0, nrow = 3, ncol = 1)),
  rowData = S4Vectors::DataFrame(
    ct1 = c("A", "A", "B"),
    ct2 = c("B", "C", "C"),
    z_diff = c(2.0, -1.5, 1.2),
    p_diff = c(0.01, 0.03, 0.20),
    fdr_diff = c(0.02, 0.05, 0.30)
  )
)

if (requireNamespace("ggraph", quietly = TRUE) &&
    requireNamespace("tidygraph", quietly = TRUE)) {
  p_net <- plot_spatial_network(
    se_diff,
    fdr_threshold = 0.2,
    z_sign = "both",
    include_nonsig = TRUE,
    layout = "fr",
    node_size_by = "degree"
  )
  print(p_net)
}
}
