From 2d48bbdf18e5c6a7c45a6d3bbaadc8ff3ead4832 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 6 Sep 2017 11:44:54 +0200 Subject: 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) --- R/plot.mkinfit.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'R') 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")) -- cgit v1.2.1