[CHNOSZ-commits] r598 - in pkg/CHNOSZ: . R inst inst/extdata/OBIGT inst/extdata/adds inst/extdata/thermo man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 15 08:36:18 CEST 2020


Author: jedick
Date: 2020-08-15 08:36:17 +0200 (Sat, 15 Aug 2020)
New Revision: 598

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv
   pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv
   pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv
   pkg/CHNOSZ/inst/extdata/thermo/stoich.csv.xz
   pkg/CHNOSZ/man/diagram.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/multi-metal.Rmd
Log:
Use default colors for fill = NA in diagram()


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/DESCRIPTION	2020-08-15 06:36:17 UTC (rev 598)
@@ -1,6 +1,6 @@
 Date: 2020-08-15
 Package: CHNOSZ
-Version: 1.3.6-71
+Version: 1.3.6-72
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 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	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/R/diagram.R	2020-08-15 06:36:17 UTC (rev 598)
@@ -588,7 +588,10 @@
       ### now on to the diagram itself
 
       # colors to fill predominance fields
-      if(is.null(fill) | length(fill)==0) fill <- "transparent"
+      if(is.null(fill)) {
+        if(length(unique(eout$species$state)) == 1) fill <- "transparent"
+        else fill <- ifelse(grepl("cr,cr", eout$species$state), "#DEB88788", ifelse(grepl("cr", eout$species$state), "#FAEBD788", "#F0F8FF88"))
+      } else if(identical(fill, NA) | length(fill)==0) fill <- "transparent"
       else if(isTRUE(fill[1]=="rainbow")) fill <- rainbow(ngroups)
       else if(isTRUE(fill[1] %in% c("heat", "terrain", "topo", "cm"))) fill <- get(paste0(fill[1], ".colors"))(ngroups)
       else if(getRversion() >= "3.6.0" & length(fill)==1) {

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2020-08-15 06:36:17 UTC (rev 598)
@@ -87,8 +87,8 @@
       loellingite, westerveldite, and aqueous As(OH)\s{3} and AsO(OH)\s{3} from
       \href{https://doi.org/10.1016/j.gca.2007.11.017}{Perfetti et al., 2008}.
 
-      \item \samp{inorganic_cr.csv}: Add Mn oxides (manganosite, pyrolusite,
-      bixbyite, and hausmannite) from
+      \item \samp{inorganic_cr.csv}: Add manganese and Mn oxides (manganosite,
+      pyrolusite, bixbyite, and hausmannite) from
       \href{https://pubs.er.usgs.gov/publication/b2131}{Robie and Hemingway,
         1995}.
 
@@ -255,6 +255,8 @@
 
       \item TODO: get entropies for Am, Pu, Cm, Np.
 
+      \item TODO: use default colors for 'fill' in diagram().
+
     }
   }
 

Modified: pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/inorganic_cr.csv	2020-08-15 06:36:17 UTC (rev 598)
@@ -140,3 +140,4 @@
 pyrolusite,NA,MnO2,cr,RH95,NA,15.Aug.20,J,-465000,-520000,52.8,54.76,16.61,290.4,-144.2,20.12,-3787,4.541,0,0,850
 bixbyite,NA,Mn2O3,cr,RH95,NA,15.Aug.20,J,-882100,-959000,113.7,101.81,31.37,162.4,12.11,10.46,-1317,0.3462,0,0,1400
 hausmannite,NA,Mn3O4,cr,RH95,NA,15.Aug.20,J,-1282500,-1384500,164.1,142.02,46.95,-7.432,94.87,-67.12,3396,0,0,0,1400
+manganese,NA,Mn,cr,RH95,NA,15.Aug.20,J,0,0,32.01,26.19,7.354,0,41.345,-2.7217,313.29,-1.3745,0,0,980

Modified: pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/inst/extdata/OBIGT/refs.csv	2020-08-15 06:36:17 UTC (rev 598)
@@ -59,7 +59,7 @@
 HSS95,"J. R. Haas, E. L. Shock and D. C. Sassani",1995,"Geochim. Cosmochim. Acta 59, 4329-4350","complexes of rare earth elements",https://doi.org/10.1016/0016-7037(95)00314-P
 PH95,"V. A. Pokrovskii and H. C. Helgeson",1995,"Am. J. Sci. 295, 1255-1342","aluminum species",https://doi.org/10.2475/ajs.295.10.1255
 PK95,"V. B. Parker and I. L. Khodakovskii",1995,"J. Phys. Chem. Ref. Data 24, 1699-1745",melanterite,https://doi.org/10.1063/1.555964
-RH95,"R. A. Robie and B. S. Hemingway",1995,"U. S. Geological Survey Bull. 2131","manganosite, pyrolusite, bixbyite, and hausmannite",https://pubs.er.usgs.gov/publication/b2131
+RH95,"R. A. Robie and B. S. Hemingway",1995,"U. S. Geological Survey Bull. 2131","manganese, manganosite, pyrolusite, bixbyite, and hausmannite",https://pubs.er.usgs.gov/publication/b2131
 RH95.1,"R. A. Robie and B. S. Hemingway",1995,"U. S. Geological Survey Bull. 2131","hydrogen fluoride and hydrogen chloride",https://pubs.er.usgs.gov/publication/b2131
 RH95.2,"R. A. Robie and B. S. Hemingway",1995,"U. S. Geological Survey Bull. 2131","dawsonite: Cp coefficients corrected in @TKSS14; Cp value at 25 °C from @BPAH07, citing @FSR76",https://pubs.er.usgs.gov/publication/b2131
 RH95.3,"R. A. Robie and B. S. Hemingway",1995,"U. S. Geological Survey Bull. 2131","almandine, dickite, glaucophane, grunerite, pyrope (G and H not in SUPCRT92)",https://pubs.er.usgs.gov/publication/b2131

Modified: pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/inst/extdata/adds/OBIGT_check.csv	2020-08-15 06:36:17 UTC (rev 598)
@@ -249,24 +249,24 @@
 "OBIGT",1974,"orpiment","cr","J",,,-1036
 "OBIGT",1982,"dawsonite","cr","J",,,19466
 "OBIGT",1984,"ferberite","cr","J",1.21,,
-"OBIGT",2010,"octadecane","cr","cal",-2.63,,
-"OBIGT",2011,"nonadecane","cr","cal",-13.32,,
-"OBIGT",2012,"eicosane","cr","cal",-2.79,,
-"OBIGT",2013,"heneicosane","cr","cal",-8.61,,
-"OBIGT",2014,"docosane","cr","cal",-2.63,,
-"OBIGT",2015,"tricosane","cr","cal",-5.22,,
-"OBIGT",2016,"tetracosane","cr","cal",-2.02,,
-"OBIGT",2017,"pentacosane","cr","cal",-2.93,,
-"OBIGT",2018,"hexacosane","cr","cal",-1.29,,
-"OBIGT",2019,"heptacosane","cr","cal",-1.23,,
-"OBIGT",2071,"carbazole","cr","cal",-43.39,,
-"OBIGT",2112,"triphenylene","cr","cal",,,541
-"OBIGT",2425,"deoxyadenosine","cr","cal",,,-2977
-"OBIGT",2583,"ethylene","gas","cal",-4.59,,
-"OBIGT",2593,"3,5-dimethylphenol","gas","cal",,,628
-"OBIGT",2903,"nonacontane","liq","cal",,,635
-"OBIGT",2910,"2-methyloctane","liq","cal",10,,
-"OBIGT",3323,"5,6-dithiadecane","liq","cal",2,,
+"OBIGT",2011,"octadecane","cr","cal",-2.63,,
+"OBIGT",2012,"nonadecane","cr","cal",-13.32,,
+"OBIGT",2013,"eicosane","cr","cal",-2.79,,
+"OBIGT",2014,"heneicosane","cr","cal",-8.61,,
+"OBIGT",2015,"docosane","cr","cal",-2.63,,
+"OBIGT",2016,"tricosane","cr","cal",-5.22,,
+"OBIGT",2017,"tetracosane","cr","cal",-2.02,,
+"OBIGT",2018,"pentacosane","cr","cal",-2.93,,
+"OBIGT",2019,"hexacosane","cr","cal",-1.29,,
+"OBIGT",2020,"heptacosane","cr","cal",-1.23,,
+"OBIGT",2072,"carbazole","cr","cal",-43.39,,
+"OBIGT",2113,"triphenylene","cr","cal",,,541
+"OBIGT",2426,"deoxyadenosine","cr","cal",,,-2977
+"OBIGT",2584,"ethylene","gas","cal",-4.59,,
+"OBIGT",2594,"3,5-dimethylphenol","gas","cal",,,628
+"OBIGT",2904,"nonacontane","liq","cal",,,635
+"OBIGT",2911,"2-methyloctane","liq","cal",10,,
+"OBIGT",3324,"5,6-dithiadecane","liq","cal",2,,
 "DEW",8,"AlO2(SiO2)-","aq","cal",,,-897
 "DEW",17,"BO(OH)","aq","cal",,,-1111
 "DEW",19,"Ca(HCO3)+","aq","cal",,,-2971

Modified: pkg/CHNOSZ/inst/extdata/thermo/stoich.csv.xz
===================================================================
(Binary files differ)

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/man/diagram.Rd	2020-08-15 06:36:17 UTC (rev 598)
@@ -135,8 +135,10 @@
 \section{2-D diagrams}{
 On 2-D diagrams, the fields represent the species with the highest equilibrium activity.
 \code{fill} determines the color of the predominance fields, \code{col} that of the boundary lines.
-The default of NULL for \code{fill} produces transparent predominance fields.
-\code{fill} can be any \code{\link{colors}}, or the word \samp{rainbow}, \samp{heat}, \samp{terrain}, \samp{topo}, or \samp{cm}, indicating a palette from \pkg{grDevices}.
+The default of NULL for \code{fill} uses a light blue, light tan, and darker tan color for fields with aqueous species, one solid, or two solids.
+These correspond to the web colors "aliceblue", "antiquewhite", and "burlywood" with some transparency added; see \viglink{multi-metal} for an example with two solids produced using \code{\link{mix}}.
+If all the species in the diagram have the same state, or if the \code{fill} argument is NA or a 0-length value, the predominance fields are transparent, i.e. no fill color is used.
+Otherwise, \code{fill} can be any \code{\link{colors}}, or the word \samp{rainbow}, \samp{heat}, \samp{terrain}, \samp{topo}, or \samp{cm}, indicating a palette from \pkg{grDevices}.
 Starting with \R version 3.6.0, \code{fill} can be the name of any available HCL color palette, matched in the same way as the \code{palette} argument of \code{hcl.colors}.
 
 \code{fill.NA} gives the color for empty fields, i.e. points at which NA values are present for any species.

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2020-08-15 06:36:17 UTC (rev 598)
@@ -658,7 +658,7 @@
 res <- 200
 bases <- c("H2S", "HS-", "HSO4-", "SO4-2")
 m1 <- mosaic(bases, pH = c(0, 12, res), Eh=c(-1.2, 0.75, res), T=T)
-diagram(m1$A.species, lwd = 2, fill = NA)
+diagram(m1$A.species, lwd = 2)
 diagram(m1$A.bases, add = TRUE, col = "red1", col.names = "red1", lty = 3,
         italic = TRUE)
 water.lines(m1$A.species, col = "blue1")

Modified: pkg/CHNOSZ/vignettes/multi-metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd	2020-08-15 02:15:16 UTC (rev 597)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd	2020-08-15 06:36:17 UTC (rev 598)
@@ -235,28 +235,23 @@
 species(iFeV.cr)
 aFeV <- affinity(aFe)  # argument recall
 dFeV <- diagram(aFeV, plot.it = FALSE, bold = TRUE)
-# Function to assign field colors
-fill <- function(a) {
-  ifelse(grepl("cr,cr", a$species$state), "#DEB88788",
-    ifelse(grepl("cr", a$species$state), "#FAEBD788", "#F0F8FF88")
-)}
 # 1:1 mixture (Fe:V)
 a11 <- mix(dFe, dV, dFeV, c(1, 1))
-diagram(a11, fill = fill(a11), min.area = 0.01)
+diagram(a11, min.area = 0.01)
 title("Fe:V = 1:1")
 label.figure(lTP(25, 1), xfrac = 0.12)
 # 1:3 mixture
 a13 <- mix(dFe, dV, dFeV, c(1, 3))
-diagram(a13, fill = fill(a13), min.area = 0.01)
+diagram(a13, min.area = 0.01)
 title("Fe:V = 1:3")
 # 1:5 mixture
 a15 <- mix(dFe, dV, dFeV, c(1, 5))
-diagram(a15, fill = fill(a15), min.area = 0.01)
+diagram(a15, min.area = 0.01)
 title("Fe:V = 1:5")
 ```
 
 Then we calculate the affinities for the bimetallic species and save the output of `diagram()` in `dFeV`, again without making a plot, but formatting the names in bold.
-We also write a function to assign the colors for regions with two solids, one solid, and no solids; these are the web colors "burlywood", "antiquewhite" and "aliceblue" with some transparency added to show the underlying water stability region that is plotted first by `diagram()`.
+Note that `diagram()` uses different colors for regions with two solids, one solid, and no solids, including some transparency to show the underlying water stability region that is plotted first.
 
 Now we have all the ingredients needed to combine the Fe-bearing, V-bearing, and bimetallic species to generate a given composition.
 The `mix()` function  is used to calculate the affinities of formation from basis species for all combinations of aqueous species and minerals that satisfy each of three different compositions.
@@ -281,12 +276,12 @@
 species(c(iFe.aq, iFe.cr))$name
 species(1:length(iFe.aq), loga.Fe)
 aFe <- affinity(pH = c(0, 14), Eh = c(-1.5, 2))
-dFe <- diagram(aFe, fill = fill(aFe), plot.it = FALSE)
+dFe <- diagram(aFe, plot.it = FALSE)
 # V-bearing species
 species(c(iV.aq, iV.cr))$name
 species(1:length(iV.aq), loga.V)
 aV <- affinity(aFe)  # argument recall
-dV <- diagram(aV, fill = fill(aV), plot.it = FALSE)
+dV <- diagram(aV, plot.it = FALSE)
 # Bimetallic species
 species(iFeV.cr)
 aFeV <- affinity(aFe)  # argument recall
@@ -293,7 +288,7 @@
 dFeV <- diagram(aFeV, plot.it = FALSE, bold = TRUE)
 # 1:1 mixture (Fe:V)
 a11 <- mix(dFe, dV, dFeV, c(1, 1))
-d11 <- diagram(a11, fill = fill(a11), min.area = 0.01)
+d11 <- diagram(a11, min.area = 0.01)
 water.lines(d11, col = "orangered")
 
 # Calculate affinity of FeVO4
@@ -302,11 +297,11 @@
 # Calculate difference from stable species
 aFeVO4_vs_stable <- aFeVO4$values[[1]] - d11$predominant.values
 # Overlay lines from diagram on color map
-diagram(a11, names = FALSE, limit.water = FALSE)
+diagram(a11, fill = NA, names = FALSE, limit.water = FALSE)
 opar <- par(usr = c(0, 1, 0, 1))
 image(aFeVO4_vs_stable, col = topo.colors(100, 0.7, TRUE), add = TRUE)
 par(opar)
-diagram(a11, add = TRUE, names = FALSE)
+diagram(a11, fill = NA, add = TRUE, names = FALSE)
 water.lines(d11, col = "orangered")
 thermo.axis()
 



More information about the CHNOSZ-commits mailing list