[CHNOSZ-commits] r854 - in pkg/CHNOSZ: . R demo man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 23 10:49:41 CET 2024
Author: jedick
Date: 2024-12-23 10:49:41 +0100 (Mon, 23 Dec 2024)
New Revision: 854
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/stack_mosaic.R
pkg/CHNOSZ/R/util.expression.R
pkg/CHNOSZ/R/util.legend.R
pkg/CHNOSZ/demo/sum_S.R
pkg/CHNOSZ/man/stack_mosaic.Rd
Log:
Update stack_mosaic()
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2024-12-01 11:39:59 UTC (rev 853)
+++ pkg/CHNOSZ/DESCRIPTION 2024-12-23 09:49:41 UTC (rev 854)
@@ -1,6 +1,6 @@
-Date: 2024-12-01
+Date: 2024-12-23
Package: CHNOSZ
-Version: 2.1.0-26
+Version: 2.1.0-27
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/stack_mosaic.R
===================================================================
--- pkg/CHNOSZ/R/stack_mosaic.R 2024-12-01 11:39:59 UTC (rev 853)
+++ pkg/CHNOSZ/R/stack_mosaic.R 2024-12-23 09:49:41 UTC (rev 854)
@@ -5,11 +5,11 @@
# col: Colors for species1, species2, and species12
# (default of NA for col[3] means to plot species12 boundaries with color for species2)
# ...: Arguments for mosaic() (including affinity() arguments)
-stack_mosaic <- function(bases, species1, species2, species12, names = NULL, col = list(4, 3, 6), col.names = list(4, 3, 6),
- fill = NULL, dx = list(0, 0, 0), dy = list(0, 0, 0), srt = list(0, 0, 0), lwd = list(1, 1, 1), lty = list(1, 1, 1),
+stack_mosaic <- function(bases, species1, species2, species12, names = NULL, col = list(1, 4, 4), col.names = list(1, 4, 4),
+ fill = list(NA, NA, NA), dx = list(0, 0, 0), dy = list(0, 0, 0), srt = list(0, 0, 0), lwd = list(1, 1, 1), lty = list(1, 1, 1),
loga_aq = NULL, plot.it = TRUE, ...) {
- # Default is to use semi-transparent fill for bimetallic species
+ # Set fill = NULL to use semi-transparent color for bimetallic species
if(is.null(fill)) fill <- list(NA, NA, adjustcolor(col.names[3], alpha.f = 0.312))
# Load species1 (first metal-bearing species)
Modified: pkg/CHNOSZ/R/util.expression.R
===================================================================
--- pkg/CHNOSZ/R/util.expression.R 2024-12-01 11:39:59 UTC (rev 853)
+++ pkg/CHNOSZ/R/util.expression.R 2024-12-23 09:49:41 UTC (rev 854)
@@ -143,7 +143,7 @@
if(T.units() == "C") expr <- substitute(degree*a, list(a = expr))
}
# Eh - electrical potential
- if(grepl("Eh", property)) expr <- substitute(a, list(a = "volt"))
+ if(grepl("Eh", property)) expr <- substitute(a, list(a = "V"))
# IS - ionic strength
if(grepl("IS", property)) expr <- substitute(a, list(a = mol~kg^-1))
if(!expr == "") {
Modified: pkg/CHNOSZ/R/util.legend.R
===================================================================
--- pkg/CHNOSZ/R/util.legend.R 2024-12-01 11:39:59 UTC (rev 853)
+++ pkg/CHNOSZ/R/util.legend.R 2024-12-23 09:49:41 UTC (rev 854)
@@ -2,7 +2,7 @@
# Functions for making legend text
# 20190530 jmd first version
-lNaCl <- function(x, digits = 2) substitute(italic(m)[NaCl] == x~mol~kg^-1, list(x = round(x, digits)))
+lNaCl <- function(x, digits = 2) substitute(NaCl == x~mol~kg^-1, list(x = round(x, digits)))
lS <- function(x, digits = 3) substitute(sum(S) == x~mol~kg^-1, list(x = round(x, digits)))
Modified: pkg/CHNOSZ/demo/sum_S.R
===================================================================
--- pkg/CHNOSZ/demo/sum_S.R 2024-12-01 11:39:59 UTC (rev 853)
+++ pkg/CHNOSZ/demo/sum_S.R 2024-12-23 09:49:41 UTC (rev 854)
@@ -67,7 +67,7 @@
diagram(sp, type = "loga.balance", contour.method = "flattest", levels = 10^(-3:5), add = TRUE, col = col, lty = 3, lwd = 1.8, cex = 1.2)
}
- # Add legends and title
+ # Add legend and title
T_P <- describe.property(c("T", "P"), c(T, P))
P_Cl <- c(bquote(pH == .(pH)), bquote(NaCl == .(m_NaCl)~mol~kg^-1))
legend <- lex(T_P, P_Cl)
Modified: pkg/CHNOSZ/man/stack_mosaic.Rd
===================================================================
--- pkg/CHNOSZ/man/stack_mosaic.Rd 2024-12-01 11:39:59 UTC (rev 853)
+++ pkg/CHNOSZ/man/stack_mosaic.Rd 2024-12-23 09:49:41 UTC (rev 854)
@@ -9,7 +9,7 @@
\usage{
stack_mosaic(bases, species1, species2, species12, names = NULL,
- col = list(4, 3, 6), col.names = list(4, 3, 6), fill = NULL,
+ col = list(1, 4, 4), col.names = list(1, 4, 4), fill = list(NA, NA, NA),
dx = list(0, 0, 0), dy = list(0, 0, 0), srt = list(0, 0, 0),
lwd = list(1, 1, 1), lty = list(1, 1, 1), loga_aq = NULL,
plot.it = TRUE, ...)
@@ -74,7 +74,7 @@
basis(c("pyrite", "Cu", "Cl-", "H2S", "H2O", "oxygen", "H+"))
basis("H2S", -2)
# Calculate solution composition for 1 mol/kg NaCl
-NaCl <- NaCl(T = T, P = P, m_tot = 1)
+NaCl <- NaCl(m_tot = 1, T = T, P = P)
basis("Cl-", log10(NaCl$m_Cl))
# Define arguments for stack_mosaic: Speciate aqueous sulfur
@@ -84,20 +84,12 @@
# Calculate stabilities of Cu-bearing and FeCu-bearing minerals second
species2 <- c("copper", "cuprite", "tenorite", "chalcocite", "covellite")
species12 <- c("chalcopyrite", "bornite")
-# Use abbreviations for Fe-bearing minerals and formulas for Cu-bearing minerals
-names1 <- c("Py", "Po", "Mag", "Hem")
-names2 <- info(info(species2))$formula
-names12 <- info(info(species12))$formula
-names <- list(names1, names2, names12)
# Adjust x-position for one species (chalcocite, Cu2S)
dx <- list(c(0, 0, 0, 0), c(0, 0, 0, 1, 0), c(0, 0))
-# Use thick dashed lines for the bimetallic species
-lwd <- list(1, 1, 2)
-lty <- list(1, 1, 2)
# Make the diagram
-stack_mosaic(bases, species1, species2, species12, names = names,
- dx = dx, lwd = lwd, lty = lty,
+stack_mosaic(bases,
+ species1, species2, species12, dx = dx,
pH = pH, O2 = O2, T = T, P = P, IS = NaCl$IS)
# Add legend and title
lTP <- lex(lTP(T, P))
More information about the CHNOSZ-commits
mailing list