% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rAMMIPlot.R
\name{rAMMIPlot}
\alias{rAMMIPlot}
\title{AMMI Biplots with \pkg{ggplot2}}
\usage{
rAMMIPlot(
  model_res,
  colGen = "gray47",
  colEnv = "darkred",
  sizeGen = 6,
  sizeEnv = 6,
  titles = TRUE,
  footnote = TRUE,
  axis_expand = 1.2,
  limits = TRUE,
  axes = TRUE,
  axislabels = TRUE
)
}
\arguments{
\item{model_res}{an object of class \code{rAMMI} generated by \code{\link{rAMMIModel}}.}

\item{colGen}{color for genotype labels. Defaults to `"gray47"`.}

\item{colEnv}{color for environment labels and vectors. Defaults to `"darkred"`.}

\item{sizeGen}{text size for genotype labels. Defaults to 6.}

\item{sizeEnv}{text size for environment labels. Defaults to 6.}

\item{titles}{logical. If `TRUE` (default), a title indicating the model 
type is added to the plot.}

\item{footnote}{logical. If `TRUE` (default), a caption with the percentage 
of explained GxE variation is added at the bottom.}

\item{axis_expand}{numeric value to expand the axis limits. Useful to prevent 
labels from being cut off. Defaults to 1.2.}

\item{limits}{logical. If `TRUE` (default), uses \code{coord_fixed()} to 
maintain a 1:1 aspect ratio between axes.}

\item{axes}{logical. If `TRUE` (default), draws dashed horizontal and 
vertical lines passing through the origin (0,0).}

\item{axislabels}{logical. If `TRUE` (default), includes axis titles with 
the percentage of variance explained by each principal component.}
}
\value{
A \pkg{ggplot2} object. This allows further customization using 
  standard ggplot layers (e.g., \code{+ theme_bw()}).
}
\description{
Generates a high-quality biplot (PC1 vs PC2) for classical or 
  robust AMMI models using the \pkg{ggplot2} framework.
}
\details{
the biplot is constructed using a scaling factor of 0.5 (symmetric scaling), 
which allows representing both genotypes and environments in the same 
algebraic space. Genotypes are displayed as points (text), and environments 
are represented as vectors from the origin.
}
\examples{
library(agridat)
data(yan.winterwheat)

# Classical AMMI
mod_ammi <- rAMMIModel(yan.winterwheat, genotype = "gen", 
                       environment = "env", response = "yield", type = "AMMI")

rAMMIPlot(mod_ammi,sizeGen=4,sizeEnv=4)

data(plrv)
mod_ammi_rep <- rAMMIModel(plrv, genotype="Genotype", environment="Locality", 
                        response="Yield", rep="Rep", type="AMMI")
rAMMIPlot(mod_ammi_rep,sizeGen=4,sizeEnv=4)

}
