% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/visualization.R
\name{plot_dose_response_curves}
\alias{plot_dose_response_curves}
\title{Plot dose-response curves for two conditions}
\usage{
plot_dose_response_curves(
  data,
  drug = NULL,
  response = "normalized_cell_count",
  concentration = "concentration",
  condition = "condition",
  drug_col = "drug_name",
  n_points = 200,
  colors = c("#0072B2", "#D55E00", "#009E73", "#CC79A7"),
  shapes = c(19, 15, 17, 18),
  ref_line = 0.5,
  legend_title = "Condition"
)
}
\arguments{
\item{data}{A long-format data frame with one row per well/replicate,
containing drug, condition, concentration and response columns.}

\item{drug}{Optional drug name to display. If \code{NULL} (default) \code{data} is
assumed to already contain a single drug.}

\item{response}{Name of the (normalised) response column, as a string.
Default \code{"normalized_cell_count"}.}

\item{concentration}{Name of the concentration column, as a string. Default
\code{"concentration"}.}

\item{condition}{Name of the condition column, as a string. Default
\code{"condition"}.}

\item{drug_col}{Name of the drug identifier column, as a string. Default
\code{"drug_name"}.}

\item{n_points}{Number of points used to draw each smooth fitted curve.
Default \code{200}.}

\item{colors}{Character vector of colours, one per condition (recycled from
the pipeline palette by default).}

\item{shapes}{Numeric vector of point shapes, one per condition.}

\item{ref_line}{Numeric response level at which to draw a horizontal dashed
reference line (for example the 50 \% effect level). Set to \code{NA} to omit.}

\item{legend_title}{Legend title. Default \code{"Condition"}.}
}
\value{
A \link[ggplot2:ggplot]{ggplot2::ggplot} object with a base-10 logarithmic concentration
axis, observed points and fitted 4PL curves coloured by condition.
}
\description{
Fits a four-parameter logistic model to each condition of a single drug and
overlays the observed responses with the smooth fitted curves, coloured by
condition. This is the key visual for comparing drug sensitivity between two
conditions (for example irradiated versus non-irradiated cells), making a
potency shift between conditions immediately apparent.
}
\details{
The styling reproduces the plots used throughout the screening pipeline: a
logarithmic concentration axis, distinct colour and point shape per
condition, a horizontal 50 \% reference line, and the fitted IC50/AUC of each
condition reported in the subtitle.

Only concentrations that are finite and strictly positive are used
(a log scale cannot show zero or negative doses). A condition with fewer
than four usable observations is plotted as points only, with a warning,
and no curve is fitted for it. Fitting is performed with
\code{\link[=fit_dose_response]{fit_dose_response()}}, so no external fitting package is required. The
figure uses the package's modern-academic \code{\link[=theme_hts]{theme_hts()}} look with a
colourblind-safe condition palette.
}
\examples{
one <- subset(
  screen_doseresponse,
  drug_name == "DrugA" & experiment_type == "sample"
)
plot_dose_response_curves(one, drug = "DrugA")

}
\seealso{
\code{\link[=fit_dose_response]{fit_dose_response()}}, \code{\link[=four_pl]{four_pl()}}, \code{\link[=compute_auc]{compute_auc()}}
}
