From 08cae49345c048fdbb69befc5a3b3f7966836223 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 16 Oct 2015 16:31:29 +0200 Subject: Full compound names in models that are shown in the plot --- R/mkinsub.R | 6 +++--- R/plot.mkinfit.R | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'R') diff --git a/R/mkinsub.R b/R/mkinsub.R index f92af54b..99c3ea20 100644 --- a/R/mkinsub.R +++ b/R/mkinsub.R @@ -1,4 +1,4 @@ -# Copyright (C) 2014 Johannes Ranke +# Copyright (C) 2014,2015 Johannes Ranke # Portions of this code are copyright (C) 2013 Eurofins Regulatory AG # Contact: jranke@uni-bremen.de @@ -16,8 +16,8 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see -mkinsub <- function(submodel, to = NULL, sink = TRUE) +mkinsub <- function(submodel, to = NULL, sink = TRUE, full_name = NA) { - return(list(type = submodel, to = to, sink = sink)) + return(list(type = submodel, to = to, sink = sink, full_name = full_name)) } # vim: set ts=2 sw=2 expandtab: diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R index 31746fb8..f8ee600e 100644 --- a/R/plot.mkinfit.R +++ b/R/plot.mkinfit.R @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2014 Johannes Ranke +# Copyright (C) 2010-2015 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -76,7 +76,11 @@ plot.mkinfit <- function(x, fit = x, } matlines(out$time, out[obs_vars], col = col_obs[obs_vars], lty = lty_obs[obs_vars]) if (legend == TRUE) { - legend(lpos, inset= inset, legend = obs_vars, + legend_names = lapply(names(fit$mkinmod$spec), function(x) { + if (is.na(fit$mkinmod$spec[[x]]$full_name)) x + else fit$mkinmod$spec[[x]]$full_name + }) + legend(lpos, inset= inset, legend = legend_names, col = col_obs[obs_vars], pch = pch_obs[obs_vars], lty = lty_obs[obs_vars]) } # Show residuals if requested -- cgit v1.2.1