aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/mkinparplot.R4
-rw-r--r--R/plot.mixed.mmkin.R1
-rw-r--r--R/plot.mkinfit.R2
-rw-r--r--R/plot.mmkin.R3
4 files changed, 5 insertions, 5 deletions
diff --git a/R/mkinparplot.R b/R/mkinparplot.R
index f9abab5b..8cae30fb 100644
--- a/R/mkinparplot.R
+++ b/R/mkinparplot.R
@@ -32,7 +32,8 @@ mkinparplot <- function(object) {
fractions.optim = length(fractions.optim))
n.plot <- n.plot[n.plot > 0]
- oldpars <- par(no.readonly = TRUE)
+ oldpar <- par(no.readonly = TRUE)
+ on.exit(par(oldpar, no.readonly = TRUE))
layout(matrix(1:length(n.plot), ncol = 1), heights = n.plot + 1)
s <- summary(object)
@@ -71,5 +72,4 @@ mkinparplot <- function(object) {
as.numeric(values.upper.nonInf), parname_index,
code = 3, angle = 90, length = 0.05))
}
- par(oldpars)
}
diff --git a/R/plot.mixed.mmkin.R b/R/plot.mixed.mmkin.R
index 5a0b7412..4c1f1531 100644
--- a/R/plot.mixed.mmkin.R
+++ b/R/plot.mixed.mmkin.R
@@ -146,6 +146,7 @@ plot.mixed.mmkin <- function(x,
# Start of graphical section
oldpar <- par(no.readonly = TRUE)
+ on.exit(par(oldpar, no.readonly = TRUE))
n_plot_rows = length(obs_vars)
n_plots = n_plot_rows * 2
diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R
index eced40a4..2e319aae 100644
--- a/R/plot.mkinfit.R
+++ b/R/plot.mkinfit.R
@@ -161,6 +161,7 @@ plot.mkinfit <- function(x, fit = x,
if (do_layout) {
# Layout should be restored afterwards
oldpar <- par(no.readonly = TRUE)
+ on.exit(par(oldpar, no.readonly = TRUE))
# If the observed variables are shown separately, or if requested, do row layout
if (sep_obs | row_layout) {
@@ -287,7 +288,6 @@ plot.mkinfit <- function(x, fit = x,
legend = FALSE, frame = frame)
}
}
- if (do_layout) par(oldpar, no.readonly = TRUE)
}
#' @rdname plot.mkinfit
diff --git a/R/plot.mmkin.R b/R/plot.mmkin.R
index f8ed1f9a..2166b30e 100644
--- a/R/plot.mmkin.R
+++ b/R/plot.mmkin.R
@@ -65,6 +65,7 @@ plot.mmkin <- function(x, main = "auto", legends = 1,
{
oldpar <- par(no.readonly = TRUE)
+ on.exit(par(oldpar, no.readonly = TRUE))
n.m <- nrow(x)
n.d <- ncol(x)
@@ -153,6 +154,4 @@ plot.mmkin <- function(x, main = "auto", legends = 1,
}
mtext(paste(fit_name, "residuals"), cex = cex, line = 0.4)
}
-
- par(oldpar, no.readonly = TRUE)
}

Contact - Imprint