From 6ea1ef11c87106228ab209a289386202d89de086 Mon Sep 17 00:00:00 2001 From: Pierre Chelle <45343665+pchelle@users.noreply.github.com> Date: Wed, 19 Oct 2022 07:10:28 -0400 Subject: [PATCH] Fixes #390 Fixes #391 observed and simulated time profiles (#393) --- DESCRIPTION | 2 + NAMESPACE | 2 + R/plot-observed-time-profile.R | 65 +++++++ R/plot-simulated-time-profile.R | 112 +++++++++++ R/plot-timeprofile.R | 314 ++++++++++++------------------- man/MoleculePlots.Rd | 2 +- man/plotBoxWhisker.Rd | 2 + man/plotCumulativeTimeProfile.Rd | 2 + man/plotDDIRatio.Rd | 2 + man/plotHistogram.Rd | 2 + man/plotObsVsPred.Rd | 2 + man/plotObservedTimeProfile.Rd | 55 ++++++ man/plotPKRatio.Rd | 2 + man/plotQQ.Rd | 2 + man/plotResVsPred.Rd | 2 + man/plotResVsTime.Rd | 2 + man/plotSimulatedTimeProfile.Rd | 62 ++++++ man/plotTimeProfile.Rd | 2 + man/plotTornado.Rd | 2 + 19 files changed, 437 insertions(+), 199 deletions(-) create mode 100644 R/plot-observed-time-profile.R create mode 100644 R/plot-simulated-time-profile.R create mode 100644 man/plotObservedTimeProfile.Rd create mode 100644 man/plotSimulatedTimeProfile.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 1d1dcdce..2f9f7203 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -81,9 +81,11 @@ Collate: 'plot-grid.R' 'plot-histogram.R' 'plot-obs-vs-pred.R' + 'plot-observed-time-profile.R' 'plot-pkratio.R' 'plot-qq.R' 'plot-res-vs-pred.R' + 'plot-simulated-time-profile.R' 'plot-timeprofile.R' 'plot-tornado.R' 'plotconfiguration-axis.R' diff --git a/NAMESPACE b/NAMESPACE index e088d696..a741a7a6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -134,10 +134,12 @@ export(plotDDIRatio) export(plotGrid) export(plotHistogram) export(plotObsVsPred) +export(plotObservedTimeProfile) export(plotPKRatio) export(plotQQ) export(plotResVsPred) export(plotResVsTime) +export(plotSimulatedTimeProfile) export(plotTimeProfile) export(plotTornado) export(runPlotMaker) diff --git a/R/plot-observed-time-profile.R b/R/plot-observed-time-profile.R new file mode 100644 index 00000000..68bbecc6 --- /dev/null +++ b/R/plot-observed-time-profile.R @@ -0,0 +1,65 @@ +#' @title plotObservedTimeProfile +#' @description +#' Producing Time Profile plots for observed data +#' +#' @inheritParams addScatter +#' @param dataMapping +#' An `ObservedDataMapping` object mapping `x`, `y`, `ymin`, `ymax` and aesthetic groups to their variable names of `observedData`. +#' @param plotConfiguration +#' An optional `TimeProfilePlotConfiguration` object defining labels, grid, background and watermark. +#' @return A `ggplot` object +#' +#' @export +#' @family molecule plots +#' @examples +#' # Produce a Time profile plot with observed data +#' obsData <- data.frame(x = c(1, 2, 1, 2, 3), y = c(5, 0.2, 2, 3, 4)) +#' plotObservedTimeProfile( +#' data = obsData, +#' dataMapping = ObservedDataMapping$new(x = "x", y = "y") +#' ) +plotObservedTimeProfile <- function(data = NULL, + metaData = NULL, + dataMapping = NULL, + plotConfiguration = NULL, + plotObject = NULL) { + #----- Validation and formatting of input arguments ----- + validateIsNotEmpty(data) + validateIsOfType(data, "data.frame") + dataMapping <- .setDataMapping(dataMapping, ObservedDataMapping, data) + plotConfiguration <- .setPlotConfiguration( + plotConfiguration, TimeProfilePlotConfiguration, + data, metaData, dataMapping + ) + plotObject <- .setPlotObject(plotObject, plotConfiguration) + + mapData <- dataMapping$checkMapData(data) + mapLabels <- .getAesStringMapping(dataMapping) + + #----- Build layers of molecule plot ----- + # 1- Error bars if available + if (!any(isEmpty(dataMapping$ymin), isEmpty(dataMapping$ymax))) { + plotObject <- .addErrorbarLayer( + plotObject, + data = mapData, + mapLabels = mapLabels + ) + } + # 2- Scatter points + plotObject <- .addScatterLayer( + plotObject, + data = mapData, + mapLabels = mapLabels + ) + + #----- Update properties using ggplot2::scale functions ----- + plotObject <- .updateAesProperties( + plotObject, + plotConfigurationProperty = "points", + propertyNames = c("color", "shape"), + data = mapData, + mapLabels = mapLabels + ) + plotObject <- .updateAxes(plotObject) + return(plotObject) +} diff --git a/R/plot-simulated-time-profile.R b/R/plot-simulated-time-profile.R new file mode 100644 index 00000000..4ba83a02 --- /dev/null +++ b/R/plot-simulated-time-profile.R @@ -0,0 +1,112 @@ +#' @title plotSimulatedTimeProfile +#' @description +#' Producing Time Profile plots +#' +#' @inheritParams addScatter +#' @param dataMapping +#' A `TimeProfileDataMapping` object mapping `x`, `y`, `ymin`, `ymax` and aesthetic groups to their variable names of `data`. +#' @param plotConfiguration +#' An optional `TimeProfilePlotConfiguration` object defining labels, grid, background and watermark. +#' @return A `ggplot` object +#' +#' @export +#' @family molecule plots +#' @examples +#' # Produce a Time profile plot with simulated data +#' simTime <- seq(1, 10, 0.1) +#' simData <- data.frame( +#' x = simTime, +#' y = 10 * exp(-simTime), +#' ymin = 8 * exp(-simTime), +#' ymax = 12 * exp(-simTime) +#' ) +#' +#' plotSimulatedTimeProfile( +#' data = simData, +#' dataMapping = TimeProfileDataMapping$new(x = "x", y = "y", ymin = "ymin", ymax = "ymax") +#' ) +plotSimulatedTimeProfile <- function(data = NULL, + metaData = NULL, + dataMapping = NULL, + plotConfiguration = NULL, + plotObject = NULL) { + #----- Validation and formatting of input arguments ----- + validateIsNotEmpty(data) + validateIsOfType(data, "data.frame") + dataMapping <- .setDataMapping(dataMapping, TimeProfileDataMapping, data) + plotConfiguration <- .setPlotConfiguration( + plotConfiguration, TimeProfilePlotConfiguration, + data, metaData, dataMapping + ) + plotObject <- .setPlotObject(plotObject, plotConfiguration) + + mapData <- dataMapping$checkMapData(data) + mapLabels <- .getAesStringMapping(dataMapping) + + #----- Build layers of molecule plot ----- + # 1- Ribbons if available + if (!any(isEmpty(dataMapping$ymin), isEmpty(dataMapping$ymax))) { + aestheticValues <- .getAestheticValuesFromConfiguration( + n = 1, + position = 0, + plotConfigurationProperty = plotObject$plotConfiguration$ribbons, + propertyNames = c("alpha") + ) + plotObject <- plotObject + + ggplot2::geom_ribbon( + data = mapData, + mapping = ggplot2::aes_string( + x = mapLabels$x, + ymin = mapLabels$ymin, + ymax = mapLabels$ymax, + fill = mapLabels$fill, + group = mapLabels$linetype + ), + alpha = aestheticValues$alpha, + na.rm = TRUE, + show.legend = TRUE + ) + } + + # 2- Lines + if (!isEmpty(dataMapping$y)) { + aestheticValues <- .getAestheticValuesFromConfiguration( + n = 1, + position = 0, + plotConfigurationProperty = plotObject$plotConfiguration$lines, + propertyNames = c("alpha", "size") + ) + plotObject <- plotObject + + ggplot2::geom_path( + data = mapData, + mapping = ggplot2::aes_string( + x = mapLabels$x, + y = mapLabels$y, + color = mapLabels$color, + linetype = mapLabels$linetype + ), + size = aestheticValues$size, + alpha = aestheticValues$alpha, + na.rm = TRUE, + show.legend = TRUE, + ) + } + + #----- Update properties using ggplot2::scale functions ----- + plotObject <- .updateAesProperties( + plotObject, + plotConfigurationProperty = "ribbons", + propertyNames = "fill", + data = mapData, + mapLabels = mapLabels + ) + plotObject <- .updateAesProperties( + plotObject, + plotConfigurationProperty = "lines", + propertyNames = c("color", "linetype"), + data = mapData, + mapLabels = mapLabels + ) + plotObject <- .updateAxes(plotObject) + return(plotObject) +} diff --git a/R/plot-timeprofile.R b/R/plot-timeprofile.R index 7eb1ee04..3f8d2bce 100644 --- a/R/plot-timeprofile.R +++ b/R/plot-timeprofile.R @@ -44,22 +44,34 @@ plotTimeProfile <- function(data = NULL, if (all(isEmpty(data), isEmpty(observedData))) { stop("At least 'data' or 'observedData' is required.") } - validateIsOfType(data, "data.frame", nullAllowed = TRUE) - validateIsOfType(observedData, "data.frame", nullAllowed = TRUE) - - if (!isEmpty(data)) { - dataMapping <- .setDataMapping(dataMapping, TimeProfileDataMapping, data) - } - if (!isEmpty(observedData)) { - observedDataMapping <- .setDataMapping(observedDataMapping, ObservedDataMapping, observedData) + # If no observed data, plotTimeProfile = plotSimulatedTimeProfile + if (isEmpty(observedData)) { + return(plotSimulatedTimeProfile( + data = data, + metaData = metaData, + dataMapping = dataMapping, + plotConfiguration = plotConfiguration, + plotObject = plotObject + )) } - # If data is empty, plotConfiguration from observedData is used + # If no data, plotTimeProfile = plotObservedTimeProfile if (isEmpty(data)) { - plotConfiguration <- .setPlotConfiguration( - plotConfiguration, TimeProfilePlotConfiguration, - observedData, metaData, observedDataMapping - ) + return(plotObservedTimeProfile( + data = observedData, + metaData = metaData, + dataMapping = observedDataMapping, + plotConfiguration = plotConfiguration, + plotObject = plotObject + )) } + + # In the sequel, both data and observed data are defined + validateIsOfType(data, "data.frame") + validateIsOfType(observedData, "data.frame") + + dataMapping <- .setDataMapping(dataMapping, TimeProfileDataMapping, data) + observedDataMapping <- .setDataMapping(observedDataMapping, ObservedDataMapping, observedData) + plotConfiguration <- .setPlotConfiguration( plotConfiguration, TimeProfilePlotConfiguration, data, metaData, dataMapping @@ -67,153 +79,61 @@ plotTimeProfile <- function(data = NULL, plotObject <- .setPlotObject(plotObject, plotConfiguration) - #----- Build layers of molecule plot ----- - #--- Simulated data --- - if (!isEmpty(data)) { - mapData <- dataMapping$checkMapData(data) - mapLabels <- .getAesStringMapping(dataMapping) + mapData <- dataMapping$checkMapData(data) + mapLabels <- .getAesStringMapping(dataMapping) - # Add ribbons for population time profiles - if (!any(isEmpty(dataMapping$ymin), isEmpty(dataMapping$ymax))) { - aestheticValues <- .getAestheticValuesFromConfiguration( - n = 1, - position = 0, - plotConfigurationProperty = plotObject$plotConfiguration$ribbons, - propertyNames = c("alpha") - ) - plotObject <- plotObject + - ggplot2::geom_ribbon( - data = mapData, - mapping = ggplot2::aes_string( - x = mapLabels$x, - ymin = mapLabels$ymin, - ymax = mapLabels$ymax, - fill = mapLabels$fill, - group = mapLabels$linetype - ), - alpha = aestheticValues$alpha, - na.rm = TRUE, - show.legend = TRUE - ) - } - # Add simulated time profile - if (!isEmpty(dataMapping$y)) { - aestheticValues <- .getAestheticValuesFromConfiguration( - n = 1, - position = 0, - plotConfigurationProperty = plotObject$plotConfiguration$lines, - propertyNames = c("alpha", "size") - ) - plotObject <- plotObject + - ggplot2::geom_path( - data = mapData, - mapping = ggplot2::aes_string( - x = mapLabels$x, - y = mapLabels$y, - color = mapLabels$color, - linetype = mapLabels$linetype - ), - size = aestheticValues$size, - alpha = aestheticValues$alpha, - na.rm = TRUE, - show.legend = TRUE, - ) - } - - #----- Update properties using ggplot2::scale functions ----- - plotObject <- .updateAesProperties( - plotObject, - plotConfigurationProperty = "ribbons", - propertyNames = "fill", - data = mapData, - mapLabels = mapLabels - ) - plotObject <- .updateAesProperties( - plotObject, - plotConfigurationProperty = "lines", - propertyNames = "linetype", - data = mapData, - mapLabels = mapLabels - ) - - # Get aesthetic information of simulated data for creating a legend caption data.frame - simColumnNames <- .getAesPropertyColumnNameFromLabels( - mapLabels, - c("color", "fill", "linetype") - ) - simAesLengths <- .getAesPropertyLengthFromLabels( - data = mapData, - simColumnNames, - c("color", "fill", "linetype") - ) + mapObservedData <- observedDataMapping$checkMapData(observedData) + observedMapLabels <- .getAesStringMapping(observedDataMapping) - simFillValues <- .getAestheticValuesFromConfiguration( - n = simAesLengths$fill, + #----- Build layers of molecule plot ----- + #--- Simulated data --- + # 1- If available, add ribbons for population time profiles + if (!any(isEmpty(dataMapping$ymin), isEmpty(dataMapping$ymax))) { + aestheticValues <- .getAestheticValuesFromConfiguration( + n = 1, + position = 0, plotConfigurationProperty = plotObject$plotConfiguration$ribbons, - propertyNames = "fill" - )$fill - simLinetypeValues <- .getAestheticValuesFromConfiguration( - n = simAesLengths$linetype, - plotConfigurationProperty = plotObject$plotConfiguration$lines, - propertyNames = "linetype" - )$linetype - simColorValues <- .getAestheticValuesFromConfiguration( - n = simAesLengths$color, - plotConfigurationProperty = plotObject$plotConfiguration$lines, - propertyNames = "color" - )$color - } - - #--- Simulated data only --- - if (isEmpty(observedData)) { - plotObject <- .updateAesProperties( - plotObject, - plotConfigurationProperty = "lines", - propertyNames = "color", - data = mapData, - mapLabels = mapLabels + propertyNames = c("alpha") ) - - # Add a legend caption list if legend or properties need to be updated - plotObject$plotConfiguration$legend$caption <- list( - color = data.frame( - names = levels(as.factor(mapData[, simColumnNames$color])), - labels = levels(as.factor(mapData[, simColumnNames$color])), - values = simColorValues, - stringsAsFactors = FALSE - ), - fill = data.frame( - names = levels(as.factor(mapData[, simColumnNames$fill])), - labels = levels(as.factor(mapData[, simColumnNames$fill])), - colorNames = .getColorNamesForFirstAesValues(mapData, simColumnNames, "fill"), - values = simFillValues %||% NA, - stringsAsFactors = FALSE - ), - linetype = data.frame( - names = levels(as.factor(mapData[, simColumnNames$linetype])), - labels = levels(as.factor(mapData[, simColumnNames$linetype])), - colorNames = .getColorNamesForFirstAesValues(mapData, simColumnNames, "linetype"), - values = simLinetypeValues %||% "blank", - stringsAsFactors = FALSE - ), - shape = data.frame( - names = levels(as.factor(mapData[, simColumnNames$color])), - labels = levels(as.factor(mapData[, simColumnNames$color])), - colorNames = levels(as.factor(mapData[, simColumnNames$color])), - values = " ", - stringsAsFactors = FALSE + plotObject <- plotObject + + ggplot2::geom_ribbon( + data = mapData, + mapping = ggplot2::aes_string( + x = mapLabels$x, + ymin = mapLabels$ymin, + ymax = mapLabels$ymax, + fill = mapLabels$fill, + group = mapLabels$linetype + ), + alpha = aestheticValues$alpha, + na.rm = TRUE, + show.legend = TRUE ) + } + # 2- If available, add simulated time profile + if (!isEmpty(dataMapping$y)) { + aestheticValues <- .getAestheticValuesFromConfiguration( + n = 1, + position = 0, + plotConfigurationProperty = plotObject$plotConfiguration$lines, + propertyNames = c("alpha", "size") ) - - plotObject <- .updateAxes(plotObject) - return(plotObject) + plotObject <- plotObject + + ggplot2::geom_path( + data = mapData, + mapping = ggplot2::aes_string( + x = mapLabels$x, + y = mapLabels$y, + color = mapLabels$color, + linetype = mapLabels$linetype + ), + size = aestheticValues$size, + alpha = aestheticValues$alpha, + na.rm = TRUE, + show.legend = TRUE, + ) } - - #--- Observed data --- - # Then, add observed data - mapObservedData <- observedDataMapping$checkMapData(observedData) - observedMapLabels <- .getAesStringMapping(observedDataMapping) - + # 3- If available, add error bars if (!any(isEmpty(observedDataMapping$ymin), isEmpty(observedDataMapping$ymax))) { plotObject <- .addErrorbarLayer( plotObject, @@ -221,12 +141,54 @@ plotTimeProfile <- function(data = NULL, mapLabels = observedMapLabels ) } - + # 4 - Add observed scatter points plotObject <- .addScatterLayer( plotObject, data = mapObservedData, mapLabels = observedMapLabels ) + #----- Update properties using ggplot2::scale functions ----- + plotObject <- .updateAesProperties( + plotObject, + plotConfigurationProperty = "ribbons", + propertyNames = "fill", + data = mapData, + mapLabels = mapLabels + ) + plotObject <- .updateAesProperties( + plotObject, + plotConfigurationProperty = "lines", + propertyNames = "linetype", + data = mapData, + mapLabels = mapLabels + ) + + # Get aesthetic information of simulated data for creating a legend caption data.frame + simColumnNames <- .getAesPropertyColumnNameFromLabels( + mapLabels, + c("color", "fill", "linetype") + ) + simAesLengths <- .getAesPropertyLengthFromLabels( + data = mapData, + simColumnNames, + c("color", "fill", "linetype") + ) + + simFillValues <- .getAestheticValuesFromConfiguration( + n = simAesLengths$fill, + plotConfigurationProperty = plotObject$plotConfiguration$ribbons, + propertyNames = "fill" + )$fill + simLinetypeValues <- .getAestheticValuesFromConfiguration( + n = simAesLengths$linetype, + plotConfigurationProperty = plotObject$plotConfiguration$lines, + propertyNames = "linetype" + )$linetype + simColorValues <- .getAestheticValuesFromConfiguration( + n = simAesLengths$color, + plotConfigurationProperty = plotObject$plotConfiguration$lines, + propertyNames = "color" + )$color plotObject <- .updateAesProperties( plotObject, @@ -257,51 +219,7 @@ plotTimeProfile <- function(data = NULL, propertyNames = "color" )$color - #--- Observed data only --- - if (isEmpty(data)) { - plotObject <- .updateAesProperties( - plotObject, - plotConfigurationProperty = "points", - propertyNames = "color", - data = mapObservedData, - mapLabels = observedMapLabels - ) - - plotObject$plotConfiguration$legend$caption <- list( - color = data.frame( - names = levels(as.factor(mapObservedData[, obsColumnNames$color])), - labels = levels(as.factor(mapObservedData[, obsColumnNames$color])), - values = obsColorValues, - stringsAsFactors = FALSE - ), - fill = data.frame( - names = levels(as.factor(mapObservedData[, obsColumnNames$color])), - labels = levels(as.factor(mapObservedData[, obsColumnNames$color])), - colorNames = levels(as.factor(mapObservedData[, obsColumnNames$color])), - values = NA, - stringsAsFactors = FALSE - ), - linetype = data.frame( - names = levels(as.factor(mapObservedData[, obsColumnNames$color])), - labels = levels(as.factor(mapObservedData[, obsColumnNames$color])), - colorNames = levels(as.factor(mapObservedData[, obsColumnNames$color])), - values = "blank", - stringsAsFactors = FALSE - ), - shape = data.frame( - names = levels(as.factor(mapObservedData[, obsColumnNames$shape])), - labels = levels(as.factor(mapObservedData[, obsColumnNames$shape])), - colorNames = .getColorNamesForFirstAesValues(mapObservedData, obsColumnNames, "shape"), - values = obsShapeValues %||% NA, - stringsAsFactors = FALSE - ) - ) - - plotObject <- .updateAxes(plotObject) - return(plotObject) - } - #--- Simulated and observed data --- # The final color vector needs a length of totalLength to prevent scale_color_manual to crash colorBreaks <- levels(as.factor(c(mapData[, simColumnNames$color], mapObservedData[, obsColumnNames$color]))) totalColorLength <- length(colorBreaks) diff --git a/man/MoleculePlots.Rd b/man/MoleculePlots.Rd index 7c0a7548..a19a68fb 100644 --- a/man/MoleculePlots.Rd +++ b/man/MoleculePlots.Rd @@ -5,7 +5,7 @@ \alias{MoleculePlots} \title{MoleculePlots} \format{ -An object of class \code{list} of length 10. +An object of class \code{list} of length 13. } \usage{ MoleculePlots diff --git a/man/plotBoxWhisker.Rd b/man/plotBoxWhisker.Rd index 198f7f0a..1f27d893 100644 --- a/man/plotBoxWhisker.Rd +++ b/man/plotBoxWhisker.Rd @@ -56,10 +56,12 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotCumulativeTimeProfile.Rd b/man/plotCumulativeTimeProfile.Rd index 97c32ecb..d385e52c 100644 --- a/man/plotCumulativeTimeProfile.Rd +++ b/man/plotCumulativeTimeProfile.Rd @@ -66,10 +66,12 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotDDIRatio.Rd b/man/plotDDIRatio.Rd index aa1c5876..f3a1c5ac 100644 --- a/man/plotDDIRatio.Rd +++ b/man/plotDDIRatio.Rd @@ -68,10 +68,12 @@ Other molecule plots: \code{\link{plotCumulativeTimeProfile}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotHistogram.Rd b/man/plotHistogram.Rd index 26d0f12f..f76201c1 100644 --- a/man/plotHistogram.Rd +++ b/man/plotHistogram.Rd @@ -81,10 +81,12 @@ Other molecule plots: \code{\link{plotCumulativeTimeProfile}()}, \code{\link{plotDDIRatio}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotObsVsPred.Rd b/man/plotObsVsPred.Rd index 5770309c..8ba4a9ef 100644 --- a/man/plotObsVsPred.Rd +++ b/man/plotObsVsPred.Rd @@ -73,10 +73,12 @@ Other molecule plots: \code{\link{plotCumulativeTimeProfile}()}, \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotObservedTimeProfile.Rd b/man/plotObservedTimeProfile.Rd new file mode 100644 index 00000000..18bbb7c4 --- /dev/null +++ b/man/plotObservedTimeProfile.Rd @@ -0,0 +1,55 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot-observed-time-profile.R +\name{plotObservedTimeProfile} +\alias{plotObservedTimeProfile} +\title{plotObservedTimeProfile} +\usage{ +plotObservedTimeProfile( + data = NULL, + metaData = NULL, + dataMapping = NULL, + plotConfiguration = NULL, + plotObject = NULL +) +} +\arguments{ +\item{data}{A data.frame to use for plot.} + +\item{metaData}{A named list of information about \code{data} such as the \code{dimension} and \code{unit} of its variables.} + +\item{dataMapping}{An \code{ObservedDataMapping} object mapping \code{x}, \code{y}, \code{ymin}, \code{ymax} and aesthetic groups to their variable names of \code{observedData}.} + +\item{plotConfiguration}{An optional \code{TimeProfilePlotConfiguration} object defining labels, grid, background and watermark.} + +\item{plotObject}{An optional \code{ggplot} object on which to add the plot layer} +} +\value{ +A \code{ggplot} object +} +\description{ +Producing Time Profile plots for observed data +} +\examples{ +# Produce a Time profile plot with observed data +obsData <- data.frame(x = c(1, 2, 1, 2, 3), y = c(5, 0.2, 2, 3, 4)) +plotObservedTimeProfile( + data = obsData, + dataMapping = ObservedDataMapping$new(x = "x", y = "y") +) +} +\seealso{ +Other molecule plots: +\code{\link{plotBoxWhisker}()}, +\code{\link{plotCumulativeTimeProfile}()}, +\code{\link{plotDDIRatio}()}, +\code{\link{plotHistogram}()}, +\code{\link{plotObsVsPred}()}, +\code{\link{plotPKRatio}()}, +\code{\link{plotQQ}()}, +\code{\link{plotResVsPred}()}, +\code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, +\code{\link{plotTimeProfile}()}, +\code{\link{plotTornado}()} +} +\concept{molecule plots} diff --git a/man/plotPKRatio.Rd b/man/plotPKRatio.Rd index a54904c8..1620ccad 100644 --- a/man/plotPKRatio.Rd +++ b/man/plotPKRatio.Rd @@ -60,9 +60,11 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotQQ.Rd b/man/plotQQ.Rd index 1d1efed9..c646d2b4 100644 --- a/man/plotQQ.Rd +++ b/man/plotQQ.Rd @@ -54,9 +54,11 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotResVsPred.Rd b/man/plotResVsPred.Rd index b420bb3d..c58d214f 100644 --- a/man/plotResVsPred.Rd +++ b/man/plotResVsPred.Rd @@ -56,9 +56,11 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotResVsTime.Rd b/man/plotResVsTime.Rd index 08b367e3..02ecb98e 100644 --- a/man/plotResVsTime.Rd +++ b/man/plotResVsTime.Rd @@ -56,9 +56,11 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()}, \code{\link{plotTornado}()} } diff --git a/man/plotSimulatedTimeProfile.Rd b/man/plotSimulatedTimeProfile.Rd new file mode 100644 index 00000000..f0f6b566 --- /dev/null +++ b/man/plotSimulatedTimeProfile.Rd @@ -0,0 +1,62 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot-simulated-time-profile.R +\name{plotSimulatedTimeProfile} +\alias{plotSimulatedTimeProfile} +\title{plotSimulatedTimeProfile} +\usage{ +plotSimulatedTimeProfile( + data = NULL, + metaData = NULL, + dataMapping = NULL, + plotConfiguration = NULL, + plotObject = NULL +) +} +\arguments{ +\item{data}{A data.frame to use for plot.} + +\item{metaData}{A named list of information about \code{data} such as the \code{dimension} and \code{unit} of its variables.} + +\item{dataMapping}{A \code{TimeProfileDataMapping} object mapping \code{x}, \code{y}, \code{ymin}, \code{ymax} and aesthetic groups to their variable names of \code{data}.} + +\item{plotConfiguration}{An optional \code{TimeProfilePlotConfiguration} object defining labels, grid, background and watermark.} + +\item{plotObject}{An optional \code{ggplot} object on which to add the plot layer} +} +\value{ +A \code{ggplot} object +} +\description{ +Producing Time Profile plots +} +\examples{ +# Produce a Time profile plot with simulated data +simTime <- seq(1, 10, 0.1) +simData <- data.frame( + x = simTime, + y = 10 * exp(-simTime), + ymin = 8 * exp(-simTime), + ymax = 12 * exp(-simTime) +) + +plotSimulatedTimeProfile( + data = simData, + dataMapping = TimeProfileDataMapping$new(x = "x", y = "y", ymin = "ymin", ymax = "ymax") +) +} +\seealso{ +Other molecule plots: +\code{\link{plotBoxWhisker}()}, +\code{\link{plotCumulativeTimeProfile}()}, +\code{\link{plotDDIRatio}()}, +\code{\link{plotHistogram}()}, +\code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, +\code{\link{plotPKRatio}()}, +\code{\link{plotQQ}()}, +\code{\link{plotResVsPred}()}, +\code{\link{plotResVsTime}()}, +\code{\link{plotTimeProfile}()}, +\code{\link{plotTornado}()} +} +\concept{molecule plots} diff --git a/man/plotTimeProfile.Rd b/man/plotTimeProfile.Rd index 37dd7094..004a4e7d 100644 --- a/man/plotTimeProfile.Rd +++ b/man/plotTimeProfile.Rd @@ -62,10 +62,12 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTornado}()} } \concept{molecule plots} diff --git a/man/plotTornado.Rd b/man/plotTornado.Rd index c21cc572..d58852fc 100644 --- a/man/plotTornado.Rd +++ b/man/plotTornado.Rd @@ -62,10 +62,12 @@ Other molecule plots: \code{\link{plotDDIRatio}()}, \code{\link{plotHistogram}()}, \code{\link{plotObsVsPred}()}, +\code{\link{plotObservedTimeProfile}()}, \code{\link{plotPKRatio}()}, \code{\link{plotQQ}()}, \code{\link{plotResVsPred}()}, \code{\link{plotResVsTime}()}, +\code{\link{plotSimulatedTimeProfile}()}, \code{\link{plotTimeProfile}()} } \concept{molecule plots}