aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2017-09-06 11:44:54 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2017-09-06 11:44:54 +0200
commit2d48bbdf18e5c6a7c45a6d3bbaadc8ff3ead4832 (patch)
tree53994cad083ea90d16d67940fa78004926e7ccaf
parentefa36644fd47349cca864ac70de0b3fb4156ae7c (diff)
Fix scaling of residual plots ...
... in the case of separate plots for each observed variable as obtained with plot_sep() or plot.mkinfit(..., sep_obs = TRUE)
-rw-r--r--R/plot.mkinfit.R8
1 files changed, 6 insertions, 2 deletions
diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R
index b42ce097..baa88069 100644
--- a/R/plot.mkinfit.R
+++ b/R/plot.mkinfit.R
@@ -186,11 +186,15 @@ plot.mkinfit <- function(x, fit = x,
# Show residuals if requested
if (show_residuals) {
residuals <- subset(fit$data, variable %in% row_obs_vars, residual)
- if (maxabs == "auto") maxabs = max(abs(residuals), na.rm = TRUE)
+ if (maxabs == "auto") {
+ maxabs_row = max(abs(residuals), na.rm = TRUE)
+ } else {
+ maxabs_row = maxabs
+ }
if (!sep_obs) par(mar = c(5, 4, 0, 2) + 0.1)
plot(0, type="n",
xlim = xlim,
- ylim = c(-1.2 * maxabs, 1.2 * maxabs),
+ ylim = c(-1.2 * maxabs_row, 1.2 * maxabs_row),
xlab = xlab, ylab = "Residuals")
for(obs_var in row_obs_vars){
residuals_plot <- subset(fit$data, variable == obs_var, c("time", "residual"))

Contact - Imprint