[CHNOSZ-commits] r67 - in pkg/CHNOSZ: . R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 8 14:07:31 CET 2014


Author: jedick
Date: 2014-12-08 14:07:30 +0100 (Mon, 08 Dec 2014)
New Revision: 67

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/inst/NEWS
Log:
diagram() returns 'lx', 'ly' and 'is'


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2014-03-23 02:53:46 UTC (rev 66)
+++ pkg/CHNOSZ/DESCRIPTION	2014-12-08 13:07:30 UTC (rev 67)
@@ -1,6 +1,6 @@
-Date: 2014-03-23
+Date: 2014-11-20
 Package: CHNOSZ
-Version: 1.0.3-4
+Version: 1.0.3-5
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2014-03-23 02:53:46 UTC (rev 66)
+++ pkg/CHNOSZ/R/diagram.R	2014-12-08 13:07:30 UTC (rev 67)
@@ -189,6 +189,8 @@
       }
     }
 
+    out2D <- list()
+
     if(nd==0) {
 
       ### 0-D diagram - bar graph of properties of species or reactions
@@ -345,7 +347,7 @@
       }
       ## label plot function
       # calculate coordinates for field labels
-      plot.names <- function(out,xs,ys,names) {
+      plot.names <- function(out, xs, ys, names) {
         ll <- ngroups
         lx <- numeric(ll); ly <- numeric(ll); n <- numeric(ll)
         for(j in nrow(out):1) {
@@ -367,7 +369,8 @@
         # plot field labels
         # the cex argument in this function specifies the character 
         # expansion of the labels relative to the current
-        text(lx,ly,labels=names[is],cex=cex.names,col=col.names[is])
+        if(!is.null(names)) text(lx, ly, labels=names[is], cex=cex.names, col=col.names[is])
+        return(list(lx=lx, ly=ly, is=which(is)))
       }
 
       ### done with predominance diagram functions
@@ -407,13 +410,14 @@
         # put predominance matrix in the right order for image() etc
         zs <- t(predominant[, ncol(predominant):1])
         if(!is.null(fill)) fill.color(xs, ys, zs, fill, ngroups)
-        if(!is.null(names)) plot.names(zs, xs, ys, names)
+        pn <- plot.names(zs, xs, ys, names)
         if(!is.null(dotted)) plot.line(zs, xlim, ylim, dotted, col, lwd, xrange=xrange)
       } # done with the 2D plot!
+      out2D <- list(lx=pn$lx, ly=pn$ly, is=pn$is)
     } # end if(nd==2)
   } # end if(plot.it)
 
-  out <- c(eout, list(plotvar=plotvar, plotvals=plotvals, names=names, predominant=predominant))
+  out <- c(eout, list(plotvar=plotvar, plotvals=plotvals, names=names, predominant=predominant), out2D)
   return(invisible(out))
 }
 

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2014-03-23 02:53:46 UTC (rev 66)
+++ pkg/CHNOSZ/inst/NEWS	2014-12-08 13:07:30 UTC (rev 67)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.3-4 (2014-03-23)
+CHANGES IN CHNOSZ 1.0.3-5 (2014-11-20)
 --------------------------------------
 
 - Add files with average amino acid compositions of proteins from Bison
@@ -11,6 +11,10 @@
 - In energy(), add missing 'IS' argument in call to subcrt(). Thanks to
   Grayson Boyer for the bug report.
 
+- diagram() returns 'lx', 'ly' and 'is' for calculated positions of
+  labels and indices of those species in predominance diagrams,
+  including when the labels aren't plotted (by setting names=FALSE).
+
 CHANGES IN CHNOSZ 1.0.3 (2014-01-12)
 ------------------------------------
 



More information about the CHNOSZ-commits mailing list