[CHNOSZ-commits] r623 - in pkg/CHNOSZ: demo vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 10 13:18:19 CET 2020


Author: jedick
Date: 2020-11-10 13:18:19 +0100 (Tue, 10 Nov 2020)
New Revision: 623

Modified:
   pkg/CHNOSZ/demo/buffer.R
   pkg/CHNOSZ/demo/comproportionation.R
   pkg/CHNOSZ/vignettes/multi-metal.Rmd
Log:
Fixes for earlier R versions


Modified: pkg/CHNOSZ/demo/buffer.R
===================================================================
--- pkg/CHNOSZ/demo/buffer.R	2020-11-10 11:20:45 UTC (rev 622)
+++ pkg/CHNOSZ/demo/buffer.R	2020-11-10 12:18:19 UTC (rev 623)
@@ -3,6 +3,9 @@
 # reproduces Figure 6 of Schulte and Shock, 1995 (doi:10.1007/BF01581580)
 library(CHNOSZ)
 
+# Use Helgeson et al. (1978) minerals for closer reproduction 20201110
+add.OBIGT("SUPCRT92")
+
 b.species <- c("Fe", "CO2", "H2O", "N2", "H2", "H2S", "SiO2")
 b.state <- c("cr", "gas", "liq", "gas", "gas", "aq", "aq")
 b.logact <- c(0, 1, 0, 0, 0, 0, 0)
@@ -14,12 +17,12 @@
   basis("H2", buffer)
   a <- affinity(T=xlim, P=300, return.buffer=TRUE, exceed.Ttr=TRUE)
   lines(a$vals[[1]], a$H2, col=3, lwd=2)
-  text(a$vals[[1]][ixlab], a$H2[ixlab] + 0.2, buffer)
+  text(a$vals[[1]][ixlab], a$H2[ixlab] + 0.2, buffer, font = 2)
 }
-bufferline("FeFeO", 20)
-bufferline("QFM", 38)
-bufferline("PPM", 102)
-bufferline("HM", 51)
+bufferline("FeFeO", 40)
+bufferline("QFM", 70)
+bufferline("PPM", 204)
+bufferline("HM", 102)
 # method 2: in diagram(), use the `type` argument
 basis("H2", 0)
 for(logact in c(-6, -10, -15)) {
@@ -30,8 +33,11 @@
 }
 # add legends and title
 legend("topright", legend = c("minerals", "formaldehyde", "HCN"),
-  lty=c(1, 3, 2), col=c(3, 1, 1), bg="white", cex=0.9)
+  lty = c(1, 3, 2), lwd = c(2, 1, 1), col = c(3, 1, 1), bg = "white", cex = 0.9)
 legend("bottomright", legend = c(describe.property("P", 300),
   describe.basis(ibasis=c(2,4))), bg="white", cex=0.9)
 title(main=paste("Mineral buffers and activities of aqueous species",
                  "(Schulte and Shock, 1995)", sep="\n"), cex.main=0.9)
+
+# reset OBIGT database
+reset()

Modified: pkg/CHNOSZ/demo/comproportionation.R
===================================================================
--- pkg/CHNOSZ/demo/comproportionation.R	2020-11-10 11:20:45 UTC (rev 622)
+++ pkg/CHNOSZ/demo/comproportionation.R	2020-11-10 12:18:19 UTC (rev 623)
@@ -48,7 +48,7 @@
 # make contour plot
 filled.contour(T, pH, G.kJ.4, xlab = axis.label("T"), ylab = axis.label("pH"),
   levels = -55:0,
-  color.palette = function(n) hcl.colors(n),
+  color.palette = ifelse(getRversion() >= "3.6.0", function(n) hcl.colors(n), topo.colors),
   # use plot.axes to label the contour plot (see ?filled.contour)
   plot.axes = {
     contour(T, pH, G.kJ.4, levels = c(-10, -30, -50), add = TRUE, col = "white", lwd = 2, labcex = 0.8)

Modified: pkg/CHNOSZ/vignettes/multi-metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd	2020-11-10 11:20:45 UTC (rev 622)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd	2020-11-10 12:18:19 UTC (rev 623)
@@ -299,7 +299,7 @@
 # Overlay lines from diagram on color map
 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)
+image(aFeVO4_vs_stable, col = rev(topo.colors(100, 0.7)), add = TRUE)
 par(opar)
 diagram(a11, fill = NA, add = TRUE, names = FALSE)
 water.lines(d11, col = "orangered")



More information about the CHNOSZ-commits mailing list