[CHNOSZ-commits] r567 - in pkg/CHNOSZ: . R inst vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jul 19 13:09:55 CEST 2020
Author: jedick
Date: 2020-07-19 13:09:54 +0200 (Sun, 19 Jul 2020)
New Revision: 567
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/equilibrate.R
pkg/CHNOSZ/R/util.expression.R
pkg/CHNOSZ/R/util.plot.R
pkg/CHNOSZ/inst/NEWS.Rd
pkg/CHNOSZ/vignettes/multi-metal.Rmd
Log:
Improve label formatting and placement of tick marks
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2020-07-18 03:41:12 UTC (rev 566)
+++ pkg/CHNOSZ/DESCRIPTION 2020-07-19 11:09:54 UTC (rev 567)
@@ -1,6 +1,6 @@
-Date: 2020-07-18
+Date: 2020-07-19
Package: CHNOSZ
-Version: 1.3.6-40
+Version: 1.3.6-41
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/equilibrate.R
===================================================================
--- pkg/CHNOSZ/R/equilibrate.R 2020-07-18 03:41:12 UTC (rev 566)
+++ pkg/CHNOSZ/R/equilibrate.R 2020-07-19 11:09:54 UTC (rev 567)
@@ -376,7 +376,7 @@
if(is.numeric(balance[1])) {
# a numeric vector
n.balance <- rep(balance, length.out=length(aout$values))
- message(paste0("balance: from supplied numeric argument (", balance, ")"))
+ message(paste0("balance: from supplied numeric argument (", paste(balance, collapse = ","), ")"))
} else {
# "length" for balancing on protein length
if(identical(balance, "length")) {
Modified: pkg/CHNOSZ/R/util.expression.R
===================================================================
--- pkg/CHNOSZ/R/util.expression.R 2020-07-18 03:41:12 UTC (rev 566)
+++ pkg/CHNOSZ/R/util.expression.R 2020-07-19 11:09:54 UTC (rev 567)
@@ -29,9 +29,11 @@
# append the elemental symbol
expr <- substitute(paste(a, b), list(a=expr, b=names(elements)[i]))
# recover the coefficient
- if(elements[i]==1) coeff <- "" else coeff <- elements[i]
- # append the coefficient
- expr <- substitute(a[b], list(a=expr, b=coeff))
+ coeff <- elements[i]
+ if(coeff!=1) {
+ # append the coefficient
+ expr <- substitute(a[b], list(a=expr, b=as.character(coeff)))
+ }
} else {
# for charged species, don't show "Z" but do show e.g. "+2"
coeff <- elements[i]
@@ -38,6 +40,7 @@
if(coeff==-1) coeff <- "-"
else if(coeff==1) coeff <- "+"
else if(coeff > 0) coeff <- paste("+", as.character(coeff), sep="")
+ else coeff <- as.character(coeff)
# append the coefficient as a superscript
expr <- substitute(a^b, list(a=expr, b=coeff))
}
Modified: pkg/CHNOSZ/R/util.plot.R
===================================================================
--- pkg/CHNOSZ/R/util.plot.R 2020-07-18 03:41:12 UTC (rev 566)
+++ pkg/CHNOSZ/R/util.plot.R 2020-07-19 11:09:54 UTC (rev 567)
@@ -216,8 +216,13 @@
if(!is.null(lwd)) {
for(thisside in side) {
- ## get the positions of major tick marks and make grid lines
+ ## get the positions of major tick marks
at <- axis(thisside,labels=FALSE,tick=FALSE)
+ # get nicer divisions for axes that span exactly 15 units 20200719
+ if(thisside %in% c(1,3)) lim <- par("usr")[1:2]
+ if(thisside %in% c(2,4)) lim <- par("usr")[3:4]
+ if(diff(lim)==15) at <- seq(lim[1], lim[2], length.out = 6)
+ # make grid lines
if(grid %in% c("major", "both") & thisside==1) abline(v = at, col=col.grid)
if(grid %in% c("major", "both") & thisside==2) abline(h = at, col=col.grid)
## plot major tick marks and numeric labels
@@ -238,7 +243,8 @@
da <- abs(diff(at[1:2]))
# distance between minor tick marks
di <- da / 4
- if(da %% 2 | !(da %% 10)) di <- da / 5
+ if(!da %% 3) di <- da / 3
+ else if(da %% 2 | !(da %% 10)) di <- da / 5
# number of minor tick marks
if(thisside %in% c(1,3)) {
ii <- c(1,2)
Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd 2020-07-18 03:41:12 UTC (rev 566)
+++ pkg/CHNOSZ/inst/NEWS.Rd 2020-07-19 11:09:54 UTC (rev 567)
@@ -6,7 +6,7 @@
\newcommand{\H2O}{\ifelse{latex}{\eqn{\mathrm{H_{2}O}}}{\ifelse{html}{\out{H<sub>2</sub>O}}{H2O}}}
\newcommand{\Hplus}{\ifelse{latex}{\eqn{\mathrm{H^{+}}}}{\ifelse{html}{\out{H<sup>+</sup>}}{H+}}}
-\section{Changes in CHNOSZ version 1.3.6-40 (2020-07-18)}{
+\section{Changes in CHNOSZ version 1.3.6-41 (2020-07-19)}{
\subsection{MAJOR CHANGES}{
\itemize{
@@ -199,7 +199,7 @@
\item TODO: remove stopifnot() from examples.
- \item TODO: get axis labels at intervals of 5 (0, 5, 10, 15) in thermo.plot.new(c(0, 15), c(0, 15), "x", "y").
+ \item TODO: change default to diagram(., water.lines= FALSE)
}
}
Modified: pkg/CHNOSZ/vignettes/multi-metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd 2020-07-18 03:41:12 UTC (rev 566)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd 2020-07-19 11:09:54 UTC (rev 567)
@@ -79,7 +79,7 @@
## Simple Overlay
Simple overlay refers to independent calculations for two different systems that are displayed on the same diagram.
-Although is easy to make such a diagram, there is no interaction between the systems.
+Although it is easy to make such a diagram, there is no interaction between the systems.
This example starts with a log*f*~O<sub>2</sub>~--pH base diagram for the C-O-H system then overlays a diagram for S-O-H.
The second call to `affinity()` uses the argument recall feature, where the arguments are taken from the previous command.
@@ -246,7 +246,7 @@
species(c("covellite", "chalcocite", "tenorite", "cuprite"))
aCu <- affinity(aFe) # argument recall
dCu <- diagram(aCu, xlab = xlab)
-title(paste("Only Cu; 1° balance", dCu$balance))
+title(paste("Only Cu; 1° balance:", dCu$balance))
label.plot("B")
# Only Fe- AND Cu-bearing minerals
@@ -269,7 +269,7 @@
ad2 <- duplex(d1, dFeCu, balance = "H+")
abbrv <- info(ad2$species$ispecies)$abbrv
diagram(ad2, xlab = xlab, balance = 1, names = abbrv)
-title("All Fe or Cu; 2° balance: H+")
+title("Fe and/or Cu; 2° balance: H+")
label.plot("E")
db <- describe.basis(ibasis = 3)
@@ -364,6 +364,7 @@
tN <- paste("log(total N in basis species) =", loga_N)
tC <- paste("log(total C in formed species) =", loga_C)
title(main = paste(tN, tC, sep = "\n"), font.main = 1)
+legend("topright", legend = lTP(25, 1), bty = "n")
```
The diagram shows the expected ionization of acetic acid and NH~3~ at different pHs.
More information about the CHNOSZ-commits
mailing list