% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot-permutation.R
\name{splot.tna_permutation}
\alias{splot.tna_permutation}
\alias{plot_permutation}
\title{Plot Permutation Test Results}
\usage{
splot.tna_permutation(x, ...)

plot_permutation(
  x,
  show_nonsig = FALSE,
  edge_positive_color = "#009900",
  edge_negative_color = "#C62828",
  edge_nonsig_color = "#888888",
  edge_nonsig_style = 2,
  show_stars = TRUE,
  show_effect = FALSE,
  edge_nonsig_alpha = 0.4,
  ...
)
}
\arguments{
\item{x}{A tna_permutation object (from tna::permutation_test).}

\item{...}{Additional arguments passed to splot().}

\item{show_nonsig}{Logical: show non-significant edges? Default FALSE (only significant shown).}

\item{edge_positive_color}{Color for positive differences (x > y). Default "#009900" (green).}

\item{edge_negative_color}{Color for negative differences (x < y). Default "#C62828" (red).}

\item{edge_nonsig_color}{Color for non-significant edges. Default "#888888" (grey).}

\item{edge_nonsig_style}{Line style for non-significant edges (2=dashed). Default 2.}

\item{show_stars}{Logical: show significance stars (*, **, ***) on edges? Default TRUE.}

\item{show_effect}{Logical: show effect size in parentheses for significant edges? Default FALSE.}

\item{edge_nonsig_alpha}{Alpha for non-significant edges. Default 0.4.}
}
\value{
Invisibly returns the plot.
}
\description{
Visualizes permutation test results with styling to distinguish
significant from non-significant edge differences. Works with tna_permutation
objects from the tna package.
}
\details{
The function expects a tna_permutation object containing:
\itemize{
\item \code{edges$diffs_true}: Matrix of actual edge differences (x - y)
\item \code{edges$diffs_sig}: Matrix of significant differences only
\item \code{edges$stats}: Data frame with edge_name, diff_true, effect_size, p_value
}

Edge styling:
\itemize{
\item Significant positive: solid green, bold labels with stars
\item Significant negative: solid red, bold labels with stars
\item Non-significant (when show_nonsig=TRUE): dashed grey, plain labels, lower alpha
}
}
\examples{
# Mock a tna_permutation object with synthetic data
diffs <- matrix(c(0, .15, -.1, -.2, 0, .05, .1, -.05, 0), 3, 3)
rownames(diffs) <- colnames(diffs) <- c("A", "B", "C")
diffs_sig <- diffs; diffs_sig[abs(diffs) < 0.1] <- 0
perm <- list(edges = list(
  diffs_true = diffs, diffs_sig = diffs_sig,
  stats = data.frame(
    edge_name   = c("A -> B","A -> C","B -> A","B -> C","C -> A","C -> B"),
    diff_true   = c(.15,-.1,-.2,.05,.1,-.05),
    effect_size = c(2.1,-1.5,-2.8,.4,1.2,-.3),
    p_value     = c(.01,.04,.001,.3,.02,.5))))
attr(perm, "level")  <- 0.05
attr(perm, "labels") <- c("A", "B", "C")
class(perm) <- c("tna_permutation", "list")
plot_permutation(perm)

}
