[Pomp-commits] r546 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 24 21:01:26 CEST 2011


Author: kingaa
Date: 2011-08-24 21:01:25 +0200 (Wed, 24 Aug 2011)
New Revision: 546

Modified:
   pkg/R/plot-pomp.R
Log:
- one can now change the ylabels in plotting a pomp object


Modified: pkg/R/plot-pomp.R
===================================================================
--- pkg/R/plot-pomp.R	2011-08-24 18:26:40 UTC (rev 545)
+++ pkg/R/plot-pomp.R	2011-08-24 19:01:25 UTC (rev 546)
@@ -23,8 +23,10 @@
             if (missing(variables)) {
               vars <- vars[-tpos]
               vars <- setdiff(vars,colnames(x at covar))
+              ylabels <- NULL
             } else {
               vars <- variables
+              ylabels <- names(variables)
             }
             plotpomp <- function (x, time, 
                                   xy.labels, xy.lines, panel = lines, nc, xlabel,
@@ -48,8 +50,10 @@
                 stop(sQuote("pomp")," plot error: cannot plot more than 10 series as ",dQuote("multiple"),call.=FALSE)
               if (is.null(main))
                 main <- xlabel
-              nm <- colnames(x)
+              nm <- ylab
               if (is.null(nm))
+                nm <- colnames(x)
+              if (is.null(nm))
                 nm <- paste("Series", 1:nser)
               if (is.null(nc))
                 nc <- if(nser>4){2}else{1}
@@ -94,6 +98,7 @@
               plotpomp(
                        x=X[vv],
                        time=X[[tpos]],
+                       ylab=ylabels,
                        xy.labels=FALSE,
                        xlabel=deparse(substitute(x,env=parent.frame(1))),
                        panel=panel,



More information about the pomp-commits mailing list