From b81cd4b32c8411637f31164cc696a471b1074baa Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 26 Oct 2020 14:23:04 +0100 Subject: Put the legend in its own area for plot.nlme.mmkin --- man/nlme.Rd | 6 +++++- man/nlme.mmkin.Rd | 2 ++ man/plot.nlme.mmkin.Rd | 20 ++++++-------------- 3 files changed, 13 insertions(+), 15 deletions(-) (limited to 'man') diff --git a/man/nlme.Rd b/man/nlme.Rd index 2ee2a20c..df721a0f 100644 --- a/man/nlme.Rd +++ b/man/nlme.Rd @@ -72,8 +72,12 @@ m_nlme <- nlme(value ~ nlme_f(name, time, parent_0, log_k_parent_sink), start = mean_dp) summary(m_nlme) plot(augPred(m_nlme, level = 0:1), layout = c(3, 1)) -# augPred does not seem to work on fits with more than one state +# augPred does not work on fits with more than one state # variable +# +# The procedure is greatly simplified by the nlme.mmkin function +f_nlme <- nlme(f) +plot(f_nlme) } \seealso{ diff --git a/man/nlme.mmkin.Rd b/man/nlme.mmkin.Rd index 87d84c74..041b939a 100644 --- a/man/nlme.mmkin.Rd +++ b/man/nlme.mmkin.Rd @@ -85,6 +85,7 @@ AIC(f_nlme_sfo, f_nlme_dfop) print(f_nlme_dfop) plot(f_nlme_dfop) endpoints(f_nlme_dfop) + \dontrun{ f_nlme_2 <- nlme(f["SFO", ], start = c(parent_0 = 100, log_k_parent = 0.1)) update(f_nlme_2, random = parent_0 ~ 1) @@ -131,6 +132,7 @@ endpoints(f_nlme_dfop) AIC(f_nlme_sfo, f_nlme_sfo_tc, f_nlme_dfop, f_nlme_dfop_tc) print(f_nlme_dfop_tc) } + f_2_obs <- mmkin(list("SFO-SFO" = m_sfo_sfo, "DFOP-SFO" = m_dfop_sfo), ds_2, quiet = TRUE, error_model = "obs") diff --git a/man/plot.nlme.mmkin.Rd b/man/plot.nlme.mmkin.Rd index 5f6e4ed3..6944d4b1 100644 --- a/man/plot.nlme.mmkin.Rd +++ b/man/plot.nlme.mmkin.Rd @@ -7,17 +7,16 @@ \method{plot}{nlme.mmkin}( x, i = 1:ncol(x$mmkin_orig), - main = NULL, obs_vars = names(x$mkinmod$map), standardized = TRUE, xlab = "Time", xlim = range(x$data$time), - legends = 1, - lpos = "topright", - inset = c(0.05, 0.05), resplot = c("predicted", "time"), ymax = "auto", maxabs = "auto", + ncol.legend = ifelse(length(i) <= 3, length(i) + 1, ifelse(length(i) <= 8, 3, 4)), + nrow.legend = ceiling((length(i) + 1)/ncol.legend), + rel.height.legend = 0.03 + 0.08 * nrow.legend, rel.height.bottom = 1.1, pch_ds = 1:length(i), col_ds = pch_ds + 1, @@ -32,8 +31,6 @@ \item{i}{A numeric index to select datasets for which to plot the nlme fit, in case plots get too large} -\item{main}{The main title placed on the outer margin of the plot.} - \item{obs_vars}{A character vector of names of the observed variables for which the data and the model should be plotted. Defauls to all observed variables in the model.} @@ -45,14 +42,6 @@ variables in the model.} \item{xlim}{Plot range in x direction.} -\item{legends}{An index for the fits for which legends should be shown.} - -\item{lpos}{Position(s) of the legend(s). Passed to \code{\link{legend}} as -the first argument. If not length one, this should be of the same length -as the obs_var argument.} - -\item{inset}{Passed to \code{\link{legend}} if applicable.} - \item{resplot}{Should the residuals plotted against time or against predicted values?} @@ -61,6 +50,8 @@ predicted values?} \item{maxabs}{Maximum absolute value of the residuals. This is used for the scaling of the y axis and defaults to "auto".} +\item{rel.height.legend}{The relative height of the legend shown on top} + \item{rel.height.bottom}{The relative height of the bottom plot row} \item{pch_ds}{Symbols to be used for plotting the data.} @@ -89,6 +80,7 @@ dfop_sfo <- mkinmod(parent = mkinsub("DFOP", "A1"), A1 = mkinsub("SFO"), quiet = TRUE) f <- mmkin(list("DFOP-SFO" = dfop_sfo), ds, quiet = TRUE, cores = 1) plot(f[, 3:4], standardized = TRUE) + library(nlme) # For this fit we need to increase pnlsMaxiter, and we increase the # tolerance in order to speed up the fit for this example evaluation -- cgit v1.2.1