aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-04-12 14:41:07 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2022-04-13 11:11:02 +0200
commitea57db98cef3fb882f7bd9656b44f270e7bded38 (patch)
treeeded8b3bd50eacf3c505111eb6bcf0e15b43a9d5 /R
parente99f089012c3c4a0b00ade470f180f3ee2b65e9a (diff)
More control of y axes in plot.mkinfit, updates
Documentation and test results were updated, the latter with regard to the previous work on plot.mixed.mmkin.
Diffstat (limited to 'R')
-rw-r--r--R/plot.mkinfit.R17
1 files changed, 11 insertions, 6 deletions
diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R
index 1d4ea543..cafccae9 100644
--- a/R/plot.mkinfit.R
+++ b/R/plot.mkinfit.R
@@ -20,7 +20,8 @@ utils::globalVariables(c("type", "variable", "observed"))
#' @param xlab Label for the x axis.
#' @param ylab Label for the y axis.
#' @param xlim Plot range in x direction.
-#' @param ylim Plot range in y direction.
+#' @param ylim Plot range in y direction. If given as a list, plot ranges
+#' for the different plot rows can be given for row layout.
#' @param col_obs Colors used for plotting the observed data and the
#' corresponding model prediction lines.
#' @param pch_obs Symbols to be used for plotting the data.
@@ -191,11 +192,15 @@ plot.mkinfit <- function(x, fit = x,
row_obs_vars = if (sep_obs) obs_vars[plot_row] else obs_vars
# Set ylim to sensible default, or to the specified value
- if (ylim[[1]] == "default") {
- ylim_row = c(0, max(c(subset(fit$data, variable %in% row_obs_vars)$observed,
- unlist(out[row_obs_vars])), na.rm = TRUE))
+ if (is.list(ylim)) {
+ ylim_row <- ylim[[plot_row]]
} else {
- ylim_row = ylim
+ if (ylim[[1]] == "default") {
+ ylim_row = c(0, max(c(subset(fit$data, variable %in% row_obs_vars)$observed,
+ unlist(out[row_obs_vars])), na.rm = TRUE))
+ } else {
+ ylim_row = ylim
+ }
}
if (row_layout) {
@@ -278,7 +283,7 @@ plot.mkinfit <- function(x, fit = x,
if (show_residuals) {
mkinresplot(fit, obs_vars = row_obs_vars, standardized = standardized,
pch_obs = pch_obs[row_obs_vars], col_obs = col_obs[row_obs_vars],
- legend = FALSE, frame = frame, xlab = xlab, xlim = xlim)
+ legend = FALSE, frame = frame, xlab = xlab, xlim = xlim, maxabs = maxabs)
}
# Show error model plot if requested

Contact - Imprint