% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/module3_replicate.R
\name{plot_replicate_scatter}
\alias{plot_replicate_scatter}
\title{Replicate scatter plot(s) with regression fit and correlation}
\usage{
plot_replicate_scatter(
  data,
  plate_x = NULL,
  plate_y = NULL,
  value = "viability",
  plate_col = "plate_id",
  key_col = NULL,
  compound_col = "compound_id",
  color_col = NULL,
  palette = .well_type_palette,
  line_color = "lightblue",
  band_color = "lightgray",
  show_identity = TRUE
)
}
\arguments{
\item{data}{An \code{hts_norm}/long data frame, or a data frame from
\code{\link[=calc_replicate_correlation]{calc_replicate_correlation()}} (its wide matrix is used).}

\item{plate_x, plate_y}{Plate identifiers for the two axes. When both are
\code{NULL} (default) all pairwise combinations of the available plates are
drawn; supply both to draw a single pair.}

\item{value}{Name of the value column when \code{data} is well-level. Default
\code{"viability"}.}

\item{plate_col}{Name of the plate column. Default \code{"plate_id"}.}

\item{key_col}{Column identifying matching observations across replicate
plates. Defaults to the well-address column \code{"well"} when present (so that
control wells are paired and displayed), otherwise the compound column.}

\item{compound_col}{Compound column, used as the pairing key when no \code{well}
column is available. Default \code{"compound_id"}.}

\item{color_col}{Column used to colour points, typically the well-role column.
Defaults to \code{"well_type"} when present; set to \code{NULL} to disable colouring.}

\item{palette}{Named vector mapping well-type levels to colours. Defaults to
the report palette (compounds blue, negative controls black, positive
controls red, blanks gold).}

\item{line_color, band_color}{Colour of the regression line and of its 95\%
confidence band. Default light blue on light grey, as in the reports.}

\item{show_identity}{Whether to draw the dotted \eqn{y = x} identity line.
Default \code{TRUE}.}
}
\value{
A single \link[ggplot2:ggplot]{ggplot2::ggplot} object. With three or more plates it is
faceted, one panel per replicate pair. The annotated \eqn{R} and p-value are
computed over every point shown in the panel.
}
\description{
Plots the activity of replicate plates against one another in the house style
used across the screening reports: points coloured by well type (compounds,
negative/positive controls, blanks) at 50\% opacity, a linear regression line
with a shaded 95\% confidence band, and a Pearson \eqn{R} (with p-value)
annotated on each panel. When more than two replicate plates are present and
no specific pair is requested, every pairwise combination (replicate 1 vs 2,
1 vs 3, 2 vs 3, ...) is drawn together in a single faceted figure, mirroring
the \code{combn()}-based \code{reps_corr_plot()} workflow in the source analyses.
}
\examples{
norm <- norm_by_control(baseline_subtract(read_hts_plate(hts_primary_raw)))
# All pairwise replicate comparisons at once, points coloured by well type:
plot_replicate_scatter(norm)
# A single chosen pair:
plot_replicate_scatter(norm, plate_x = "P01", plate_y = "P02")

}
\seealso{
\code{\link[=calc_replicate_correlation]{calc_replicate_correlation()}}
}
