% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gedi_plots.R
\name{plot_vector_field}
\alias{plot_vector_field}
\title{Plot Vector Field from Dynamics Analysis}
\usage{
plot_vector_field(
  dynamics_svd,
  color = NULL,
  alpha = 1,
  n_bins = 50,
  min_per_bin = 10,
  randomize = TRUE,
  arrow_size = 0.5,
  arrow_length = 0.15,
  arrow_color = "black",
  dims = c(1, 2),
  xlab = NULL,
  ylab = NULL,
  title = NULL
)
}
\arguments{
\item{dynamics_svd}{Result from model$dynamics$vector_field() or similar}

\item{color}{Vector of length N for coloring arrows, or NULL}

\item{alpha}{Vector of length N or scalar for arrow transparency}

\item{n_bins}{Integer, number of bins per dimension for aggregation}

\item{min_per_bin}{Integer, minimum observations required per bin}

\item{randomize}{Logical, whether to randomize data order}

\item{arrow_size}{Numeric, size of arrow lines}

\item{arrow_length}{Numeric, length of arrow heads (in cm)}

\item{arrow_color}{Character, color for arrows (if color is NULL)}

\item{dims}{Integer vector of length 2, which dimensions to plot}

\item{xlab}{Character, x-axis label}

\item{ylab}{Character, y-axis label}

\item{title}{Character, plot title}
}
\value{
ggplot2 object
}
\description{
Visualizes vector fields showing cell state transitions. Uses binned
aggregation for cleaner visualization without overplotting.
}
\examples{
\donttest{
# Build a tiny multi-sample fixture with a sample-level prior H so that
# model$dynamics$vector_field() is available.
set.seed(1)
n_genes <- 80; n_cells <- 60; n_samples <- 3
M <- Matrix::Matrix(
  matrix(stats::rpois(n_genes * n_cells, 5), n_genes, n_cells),
  sparse = TRUE
)
rownames(M) <- paste0("G", seq_len(n_genes))
colnames(M) <- paste0("C", seq_len(n_cells))
samples <- factor(rep(paste0("S", seq_len(n_samples)),
                      each = n_cells / n_samples))
H <- matrix(c(1, 0, 0,  0, 1, 0), nrow = 2, byrow = TRUE)
colnames(H) <- paste0("S", seq_len(n_samples))
rownames(H) <- c("cond_a", "cond_b")

model <- CreateGEDIObject(Samples = samples, M = M, K = 3, H = H,
                          verbose = 0)
model$train(iterations = 5)
vf <- model$dynamics$vector_field(start.cond = c(1, 0),
                                  end.cond   = c(0, 1))
plot_vector_field(vf)
}

}
