petab_plotData: Plot Petab data

View source: R/PEtab.R

petab_plotDataR Documentation

Plot Petab data

Description

Automatic multipage export in the background with the future package and ggforce::facet_wrap_paginate

Usage

petab_plotData(
  petab,
  i,
  j,
  aeslist = NULL,
  FLAGUseObservableTransformation = TRUE,
  FLAGmeanLine = TRUE,
  ggCallback = list(),
  ...
)

Arguments

petab

A petab object

aeslist

list of formulas used to call ggplot2::aes_q(). Default aesthetics are list(x = ~time, y = ~measurement, color = ~conditionId). Can be overriden by aeslist

FLAGmeanLine

draw line connecting the means of groups defined by c("observableId", "time", "conditionId", names(aeslist)=

ggCallback

additional stuff to add to the ggplot, such as a call to ggplot2::labs() or scales

...

Arguments to cf_outputFigure()

FLAGfuture

export asynchronously with the future package

Value

ggplot

Author(s)

Daniel Lill (daniel.lill@physik.uni-freiburg.de)

See Also

Other plotting: pd_plotParsParallelLines(), pd_plotProfilePaths(), pd_plotProfile(), petab_plotHelpers_aeslist(), petab_plotHelpers_meanMeasurementsValue(), petab_plotHelpers_parameterOrder(), petab_plotHelpers_variableOrder(), stepMax

Examples


pe <- petab_exampleRead(exampleName = "03", "pe")

# Plot data
petab_plotData(pe)

# Plot dose response: subset and remap aes(x)
petab_plotData(pe, i = conditionName == "dose response 30 min", aeslist = list(x = ~Epo))

# Change layout, scale and theme via ggCallback
petab_plotData(pe, i = conditionName == "dose response 30 min", aeslist = list(x = ~Epo),
               ggCallback = list(facet_wrap(~observableId, scales = "free"), 
                                 scale_x_log10(breaks =unique(pe$experimentalCondition[conditionName=="dose response 30 min", Epo])),
                                     theme_bw()))

# Add datapointId, plot data points with labels
pe <- petab_exampleRead(exampleName = "01", "pe")
pe <- petab_mutateDCO(pe,j=`:=`(datapointId = paste0(datasetId, "_", 1:.N)))
petab_plotData(pe, ggCallback = list(facet_wrap(~observableId, scales = "free"),
                                     ggrepel::geom_text_repel(aes(x= time, y = measurement, label = datapointId), color = "grey", size = 2)))

# Save plot to multipage pdf
td <- tempdir()
petab_plotData(pe,
               ggCallback = list(facet_wrap_paginate(~observableId, nrow = 1, ncol = 2, scales = "free"),
                                 ggrepel::geom_text_repel(aes(x= time, y = measurement, label = datapointId), color = "grey", size = 1)),
               filename = file.path(td, "plot.pdf"),
               width = 15.5, heightrel = 8/16, scale = 1, units = "cm")
system(paste0("nautilus ", td), wait = FALSE)

# Display second page of multipage plot interactively
petab_plotData(pe,
               ggCallback = list(facet_wrap_paginate(~observableId, nrow = 1, ncol = 2, scales = "free", page = 2),
                                 ggrepel::geom_text_repel(aes(x= time, y = measurement, label = datapointId), color = "grey", size = 1)))


dlill/petab documentation built on Oct. 9, 2022, 3:07 p.m.