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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 5 04:18:54 CET 2017


Author: jedick
Date: 2017-12-05 04:18:53 +0100 (Tue, 05 Dec 2017)
New Revision: 296

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/diagram.Rd
Log:
diagram(): add srt argument


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-11-21 15:16:10 UTC (rev 295)
+++ pkg/CHNOSZ/DESCRIPTION	2017-12-05 03:18:53 UTC (rev 296)
@@ -1,6 +1,6 @@
-Date: 2017-11-21
+Date: 2017-12-05
 Package: CHNOSZ
-Version: 1.1.3-2
+Version: 1.1.3-3
 Title: Thermodynamic Calculations for Geobiochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2017-11-21 15:16:10 UTC (rev 295)
+++ pkg/CHNOSZ/R/diagram.R	2017-12-05 03:18:53 UTC (rev 296)
@@ -12,14 +12,14 @@
 #source("util.misc.R")
 
 diagram <- function(
-  # primary input
+  # species affinities or activities
   eout, 
   # what to plot
   what="loga.equil", alpha=FALSE, normalize=FALSE, as.residue=FALSE, balance=NULL,
   groups=as.list(1:length(eout$values)), xrange=NULL,
-  # plot dimensions
+  # figure size and sides for axis tick marks
   mar=NULL, yline=par("mgp")[1]+0.3, side=1:4,
-  # axes
+  # axis limits and labels
   ylog=TRUE, xlim=NULL, ylim=NULL, xlab=NULL, ylab=NULL, 
   # sizes
   cex=par("cex"), cex.names=1, cex.axis=par("cex"),
@@ -28,8 +28,10 @@
   # colors
   col=par("col"), col.names=par("col"), fill=NULL,
   fill.NA="slategray1", limit.water=TRUE,
-  # labels
-  names=NULL, main=NULL, legend.x=NA, format.names=TRUE, adj=0.5, dy=0,
+  # field and line labels
+  names=NULL, format.names=TRUE, adj=0.5, dy=0, srt=0,
+  # title and legend
+  main=NULL, legend.x=NA,
   # plotting controls
   add=FALSE, plot.it=TRUE, tplot=TRUE, ...
 ) {
@@ -295,6 +297,7 @@
         if(is.na(legend.x)) {
           maxvals <- do.call(pmax, pv)
           dy <- rep(dy, length.out=length(plotvals))
+          srt <- rep(srt, length.out=length(plotvals))
           # don't assign to adj becuase that messes up the missing test below
           alladj <- rep(adj, length.out=length(plotvals))
           for(i in 1:length(plotvals)) {
@@ -326,7 +329,8 @@
               }
             }
             # also include y-offset (dy) and y-adjustment (labels bottom-aligned with the line)
-            text(xvalues[imax], plotvals[[i]][imax] + dy[i], labels=names[i], adj=c(thisadj, 0), cex=cex.names)
+            # .. and srt (string rotation) 20171127
+            text(xvalues[imax], plotvals[[i]][imax] + dy[i], labels=names[i], adj=c(thisadj, 0), cex=cex.names, srt=srt[i])
           }
         } else legend(x=legend.x, lty=lty, legend=names, col=col, cex=cex.names, lwd=lwd, ...)
       }

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-11-21 15:16:10 UTC (rev 295)
+++ pkg/CHNOSZ/inst/NEWS	2017-12-05 03:18:53 UTC (rev 296)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.3-2 (2017-11-21)
+CHANGES IN CHNOSZ 1.1.3-3 (2017-12-05)
 --------------------------------------
 
 - Lines in 1-D diagram()s can optionally be drawn as splines using the
@@ -8,6 +8,8 @@
 - Add dumpdata() for returning/writing all packaged data (including
   default database and optional data files).
 
+- Add 'srt' argument to diagram() (rotation of line labels).
+
 CHANGES IN CHNOSZ 1.1.3 (2017-11-13)
 ------------------------------------
 

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2017-11-21 15:16:10 UTC (rev 295)
+++ pkg/CHNOSZ/man/diagram.Rd	2017-12-05 03:18:53 UTC (rev 296)
@@ -9,15 +9,28 @@
 }
 
 \usage{
-  diagram(eout, what = "loga.equil", alpha = FALSE, normalize = FALSE,
+  diagram(
+    # species affinities or activities
+    eout,
+    # what to plot
+    what = "loga.equil", alpha = FALSE, normalize = FALSE,
     as.residue = FALSE, balance=NULL, groups=as.list(1:length(eout$values)),
+    # figure size and sides for axis tick marks
     xrange=NULL, mar=NULL, yline=par("mgp")[1]+0.3, side=1:4,
+    # axis limits and labels
     ylog=TRUE, xlim=NULL, ylim=NULL, xlab=NULL, ylab=NULL,
+    # character sizes
     cex=par("cex"), cex.names=1, cex.axis=par("cex"),
+    # line styles
     lty=NULL, lwd=par("lwd"), dotted=NULL, spline.method = NULL,
+    # colors
     col=par("col"), col.names=par("col"), fill=NULL,
     fill.NA="slategray1", limit.water=TRUE,
-    names=NULL, main=NULL, legend.x=NA, format.names=TRUE, adj=0.5, dy=0,
+    # field and line labels
+    names=NULL, format.names=TRUE, adj=0.5, dy=0, srt=0,
+    # title and legend
+    main=NULL, legend.x=NA,
+    # plotting controls
     add=FALSE, plot.it=TRUE, tplot=TRUE, ...)
   strip(affinity, ispecies = NULL, col = NULL, ns = NULL, 
     xticks = NULL, ymin = -0.2, xpad = 1, cex.names = 0.7)
@@ -54,11 +67,12 @@
   \item{fill.NA}{character, color for grid points with NA values}
   \item{limit.water}{logical, set NA values beyond water stability limits?}
   \item{names}{character, names of species for activity lines or predominance fields}
-  \item{main}{character, a main \code{\link{title}} for the plot; \code{NULL} means to plot no title}
-  \item{legend.x}{character, description of legend placement passed to \code{\link{legend}}}
   \item{format.names}{logical, apply formatting to chemical formulas?}
   \item{adj}{numeric, adjustment for line labels}
   \item{dy}{numeric, y offset for line labels}
+  \item{srt}{numeric, rotation for line labels}
+  \item{main}{character, a main \code{\link{title}} for the plot; \code{NULL} means to plot no title}
+  \item{legend.x}{character, description of legend placement passed to \code{\link{legend}}}
   \item{add}{logical, add to current plot?}
   \item{plot.it}{logical, make a plot?}
   \item{tplot}{logical, set up plot with \code{\link{thermo.plot.new}}?}



More information about the CHNOSZ-commits mailing list