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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 9 07:17:31 CEST 2018


Author: jedick
Date: 2018-10-09 07:17:30 +0200 (Tue, 09 Oct 2018)
New Revision: 332

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/diagram.Rd
   pkg/CHNOSZ/vignettes/hotspring.Rnw
   pkg/CHNOSZ/vignettes/hotspring.lyx
Log:
diagram(): accept numeric 'names' argument to indicate subset of names to plot


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2018-10-07 10:16:05 UTC (rev 331)
+++ pkg/CHNOSZ/DESCRIPTION	2018-10-09 05:17:30 UTC (rev 332)
@@ -1,6 +1,6 @@
-Date: 2018-10-07
+Date: 2018-10-09
 Package: CHNOSZ
-Version: 1.1.3-39
+Version: 1.1.3-40
 Title: Thermodynamic Calculations and Diagrams for Geo(bio)chemistry
 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	2018-10-07 10:16:05 UTC (rev 331)
+++ pkg/CHNOSZ/R/diagram.R	2018-10-09 05:17:30 UTC (rev 332)
@@ -215,7 +215,8 @@
 
     ## make up some names for lines/fields if they are missing
     is.pname <- FALSE
-    if(missing(names)) {
+    onames <- names
+    if(missing(names) | all(is.numeric(names))) {
       # properties of basis species or reactions?
       if(eout$property %in% c("G.basis", "logact.basis")) names <- rownames(eout$basis)
       else {
@@ -241,6 +242,12 @@
           " (", eout$species$state[isdup], ")", sep="")
       }
     }
+    # numeric values indicate a subset 20181007
+    if(all(is.numeric(onames))) {
+      if(all(onames > 0)) names[-onames] <- ""
+      else if(all(onames < 0)) names[-onames] <- ""
+      else stop("numeric 'names' should be all positive or all negative")
+    }
 
     ## apply formatting to chemical formulas 20170204
     if(all(grepl("_", names))) is.pname <- TRUE

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2018-10-07 10:16:05 UTC (rev 331)
+++ pkg/CHNOSZ/inst/NEWS	2018-10-09 05:17:30 UTC (rev 332)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.3-39 (2018-10-07)
+CHANGES IN CHNOSZ 1.1.3-40 (2018-10-09)
 ---------------------------------------
 
 THERMODYNAMIC DATA
@@ -67,6 +67,9 @@
   device has the default setting of mar from par(), mar is (re)set to
   the default value in thermo.plot.new().
 
+- diagram(): numeric 'names' now indicates subset of species names to
+  include as labels on the plot.
+
 BUG FIXES
 
 - Fix a bug where subcrt()$reaction$coeffs was incorrect for reactions

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2018-10-07 10:16:05 UTC (rev 331)
+++ pkg/CHNOSZ/man/diagram.Rd	2018-10-09 05:17:30 UTC (rev 332)
@@ -95,14 +95,19 @@
 2-D diagrams, for two variables, are plotted as predominance fields.
 The allowed variables are any that \code{\link{affinity}} accepts: temperature, pressure, or the chemical activities of the basis species
 
+A new plot is started unless \code{add} is TRUE.
+If \code{plot.it} is FALSE, no plot will be generated but all the intermediate computations will be performed and the results returned.
+
+Line or field labels use the names of the species as provided in \code{eout}; formatting is applied to chemical formuls unless \code{format.names} is FALSE.
+Use the \code{names} argument to override the default species names.
+Alternatively, supply a numeric value to \code{names} to indicate the subset of default names that should or shouldn't be plotted (positive and negative indices, respectively).
+Use \code{col.names} and \code{cex.names} to change the colors and size of the labels.
+Use \code{cex} and \code{cex.axis} to adjust the overall character expansion factors (see \code{\link{par}}) and those of the axis labels.
+The x- and y-axis labels are automatically generated unless they are supplied in \code{xlab} and \code{ylab}. 
+
 If \code{groups} is supplied, the activities of the species identified in each numeric element of this list are multiplied by the balance coefficients of the species, then summed together.
 The names of the list are used to label the lines or fields for the summed activities of the resulting groups.
 
-For all diagrams, the \code{names} of the species and their colors in \code{col.names} can be changed, as can \code{cex}, \code{cex.names}, and \code{cex.axis} to adjust the overall character expansion factors (see \code{\link{par}}) and those of the species names and axis labels.
-The x- and y-axis labels are automatically generated unless they are supplied in \code{xlab} and \code{ylab}. 
-A new plot is started unless \code{add} is TRUE.
-If \code{plot.it} is FALSE, no plot will be generated but all the intermediate computations will be performed and the results returned.
-
 \code{find.tp} finds the locations in a matrix of integers that are surrounded by the greatest number of different values.
 The function counts the unique values in a 3x3 grid around each point and returns a matrix of indices (similar to \code{\link{which}(..., arr.ind = TRUE)}) for the maximum count (ties result in more than one pair of indices).
 It can be used with the output from \code{diagram} for calculations in 2 dimensions to approximately locate the triple points on the diagram.

Modified: pkg/CHNOSZ/vignettes/hotspring.Rnw
===================================================================
--- pkg/CHNOSZ/vignettes/hotspring.Rnw	2018-10-07 10:16:05 UTC (rev 331)
+++ pkg/CHNOSZ/vignettes/hotspring.Rnw	2018-10-09 05:17:30 UTC (rev 332)
@@ -1,4 +1,4 @@
-%% LyX 2.2.2 created this file.  For more info, see http://www.lyx.org/.
+%% LyX 2.3.0 created this file.  For more info, see http://www.lyx.org/.
 %% Do not edit unless you really know what you are doing.
 \documentclass[english]{article}
 \usepackage{mathpazo}
@@ -350,7 +350,7 @@
 par(mfrow=c(1, 2))
 # first plot
 a <- affinity(T=Tlim, H2=c(-7, -4))
-diagram(a, fill=NULL, names=1:5, normalize=TRUE)
+diagram(a, fill=NULL, names=as.character(1:5), normalize=TRUE)
 lines(Tlim, get.logaH2(Tlim), lty=3)
 # second plot
 species(1:5, -3)
@@ -423,7 +423,7 @@
   for(annot in c("overall", "transferase", "synthase")) {
     ip <- ip.annot[aa.annot$protein==annot]
     a <- affinity(T=c(50, 100), H2=c(-7, -4), iprotein=ip)
-    diagram(a, fill=NULL, names=1:5, normalize=TRUE)
+    diagram(a, fill=NULL, names=as.character(1:5), normalize=TRUE)
     # add logaH2-T line
     lines(par("usr")[1:2], get.logaH2(par("usr")[1:2]), lty=3)
     # add a title

Modified: pkg/CHNOSZ/vignettes/hotspring.lyx
===================================================================
--- pkg/CHNOSZ/vignettes/hotspring.lyx	2018-10-07 10:16:05 UTC (rev 331)
+++ pkg/CHNOSZ/vignettes/hotspring.lyx	2018-10-09 05:17:30 UTC (rev 332)
@@ -1,5 +1,5 @@
-#LyX 2.2 created this file. For more info see http://www.lyx.org/
-\lyxformat 508
+#LyX 2.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 544
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -31,6 +31,8 @@
 \font_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
+\use_microtype false
+\use_dash_ligatures false
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -70,6 +72,7 @@
 \suppress_date false
 \justification true
 \use_refstyle 0
+\use_minted 0
 \index Index
 \shortcut idx
 \color #008000
@@ -82,7 +85,10 @@
 \tocdepth 3
 \paragraph_separation indent
 \paragraph_indentation default
-\quotes_language english
+\is_math_indent 0
+\math_numbering_side default
+\quotes_style english
+\dynamic_quotes 0
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
@@ -191,6 +197,7 @@
 \begin_inset CommandInset citation
 LatexCommand citep
 key "DS11,DS13"
+literal "true"
 
 \end_inset
 
@@ -244,6 +251,7 @@
 \begin_inset CommandInset citation
 LatexCommand citep
 key "DLH06"
+literal "true"
 
 \end_inset
 
@@ -251,6 +259,7 @@
 \begin_inset CommandInset citation
 LatexCommand citep
 key "LD12"
+literal "true"
 
 \end_inset
 
@@ -430,6 +439,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0022782.g005"
+literal "false"
 
 \end_inset
 
@@ -575,6 +585,7 @@
 \begin_inset CommandInset citation
 LatexCommand citep
 key "WE08"
+literal "true"
 
 \end_inset
 
@@ -918,6 +929,7 @@
 LatexCommand href
 name "plot 1"
 target "https://doi.org/10.1371/journal.pone.0022782.g004"
+literal "false"
 
 \end_inset
 
@@ -926,6 +938,7 @@
 LatexCommand href
 name "plot 2"
 target "https://doi.org/10.1371/journal.pone.0072395.g001"
+literal "false"
 
 \end_inset
 
@@ -1161,6 +1174,7 @@
 \begin_inset CommandInset citation
 LatexCommand cite
 key "DS11"
+literal "true"
 
 \end_inset
 
@@ -1168,6 +1182,7 @@
 \begin_inset CommandInset citation
 LatexCommand cite
 key "DS13"
+literal "true"
 
 \end_inset
 
@@ -1264,6 +1279,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0022782.t005"
+literal "false"
 
 \end_inset
 
@@ -1328,6 +1344,7 @@
 \begin_inset CommandInset citation
 LatexCommand citep
 key "DS11"
+literal "true"
 
 \end_inset
 
@@ -1483,7 +1500,7 @@
 
 \begin_layout Plain Layout
 
-diagram(a, fill=NULL, names=1:5, normalize=TRUE)
+diagram(a, fill=NULL, names=as.character(1:5), normalize=TRUE)
 \end_layout
 
 \begin_layout Plain Layout
@@ -1561,6 +1578,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0022782.g005"
+literal "false"
 
 \end_inset
 
@@ -1703,6 +1721,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0022782.g007"
+literal "false"
 
 \end_inset
 
@@ -1818,7 +1837,7 @@
 
 \begin_layout Plain Layout
 
-    diagram(a, fill=NULL, names=1:5, normalize=TRUE)
+    diagram(a, fill=NULL, names=as.character(1:5), normalize=TRUE)
 \end_layout
 
 \begin_layout Plain Layout
@@ -1866,6 +1885,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0072395.g002"
+literal "false"
 
 \end_inset
 
@@ -2277,6 +2297,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0072395.g003"
+literal "false"
 
 \end_inset
 
@@ -2326,6 +2347,7 @@
 \begin_inset CommandInset citation
 LatexCommand citep
 key "BPJ85"
+literal "true"
 
 \end_inset
 
@@ -2377,6 +2399,7 @@
 \begin_inset CommandInset citation
 LatexCommand citep
 key "DS11"
+literal "true"
 
 \end_inset
 
@@ -2787,6 +2810,7 @@
 LatexCommand href
 name "plot 1"
 target "https://doi.org/10.1371/journal.pone.0022782.g009"
+literal "false"
 
 \end_inset
 
@@ -2795,6 +2819,7 @@
 LatexCommand href
 name "plot 2"
 target "https://doi.org/10.1371/journal.pone.0072395.g004"
+literal "false"
 
 \end_inset
 
@@ -2973,6 +2998,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0072395.g005"
+literal "false"
 
 \end_inset
 
@@ -3118,6 +3144,7 @@
 LatexCommand href
 name "DOI link"
 target "https://doi.org/10.1371/journal.pone.0072395.g006"
+literal "false"
 
 \end_inset
 



More information about the CHNOSZ-commits mailing list