[CHNOSZ-commits] r942 - in pkg/CHNOSZ: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 8 04:39:37 CET 2025
Author: jedick
Date: 2025-12-08 04:39:36 +0100 (Mon, 08 Dec 2025)
New Revision: 942
Added:
pkg/CHNOSZ/R/thermo.plot.R
pkg/CHNOSZ/man/thermo.plot.Rd
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/NAMESPACE
pkg/CHNOSZ/R/phosphorylate.R
pkg/CHNOSZ/R/util.plot.R
pkg/CHNOSZ/man/util.plot.Rd
Log:
Add hyphen.in.pdf() and split thermo.plot.R
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2025-12-08 02:11:38 UTC (rev 941)
+++ pkg/CHNOSZ/DESCRIPTION 2025-12-08 03:39:36 UTC (rev 942)
@@ -1,6 +1,6 @@
Date: 2025-12-08
Package: CHNOSZ
-Version: 2.2.0-8
+Version: 2.2.0-9
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/NAMESPACE
===================================================================
--- pkg/CHNOSZ/NAMESPACE 2025-12-08 02:11:38 UTC (rev 941)
+++ pkg/CHNOSZ/NAMESPACE 2025-12-08 03:39:36 UTC (rev 942)
@@ -62,7 +62,7 @@
# added 20220620
"stack_mosaic",
# added 20251207
- "phosphorylate", "phospho_plot"
+ "phosphorylate", "phospho_plot", "hyphen.in.pdf"
)
# Load shared objects
Modified: pkg/CHNOSZ/R/phosphorylate.R
===================================================================
--- pkg/CHNOSZ/R/phosphorylate.R 2025-12-08 02:11:38 UTC (rev 941)
+++ pkg/CHNOSZ/R/phosphorylate.R 2025-12-08 03:39:36 UTC (rev 942)
@@ -378,8 +378,8 @@
#use.name[formula == "H3PO4"] <- FALSE
#use.name[formula == "H2P4O7"] <- FALSE
iname <- which(use.name)
- ## Change minus signs to short hyphens
- #for(i in iname) reaction$name[i] <- hyphen.in.pdf(reaction$name[i])
+ # Change minus signs to short hyphens
+ for(i in iname) reaction$name[i] <- hyphen.in.pdf(reaction$name[i])
# Get expression for reaction
reaction_expr <- describe.reaction(reaction, iname = iname)
# Add reaction to plot
Added: pkg/CHNOSZ/R/thermo.plot.R
===================================================================
--- pkg/CHNOSZ/R/thermo.plot.R (rev 0)
+++ pkg/CHNOSZ/R/thermo.plot.R 2025-12-08 03:39:36 UTC (rev 942)
@@ -0,0 +1,125 @@
+# CHNOSZ/thermo.plot.R
+# Functions to create and modify plots
+
+# Start a new plot with some customized settings
+thermo.plot.new <- function(xlim,ylim,xlab,ylab,cex = par('cex'),mar = NULL,lwd = par('lwd'),side = c(1,2,3,4),
+ mgp = c(1.7,0.3,0),cex.axis = par('cex'),col = par('col'),yline = NULL,axs = 'i',plot.box = TRUE,
+ las = 1,xline = NULL, grid = "", col.grid = "gray", ...) {
+ thermo <- get("thermo", CHNOSZ)
+ # 20120523 store the old par in thermo()$opar
+ if(is.null(thermo$opar)) {
+ thermo$opar <- par(no.readonly = TRUE)
+ assign("thermo", thermo, CHNOSZ)
+ }
+ # 20090324 mar handling: NULL - a default setting; NA - par's setting
+ # 20090413 changed mar of top side from 2 to 2.5
+ marval <- c(3, 3.5, 2.5, 1)
+ if(identical(mar[1], NA)) marval <- par("mar")
+ # 20181007 get mar from the current device (if it exists) and par("mar") is not the default
+ if(!is.null(dev.list())) {
+ if(!identical(par("mar"), c(5.1, 4.1, 4.1, 2.1))) marval <- par("mar")
+ }
+ # Assign marval to mar if the latter is NULL or NA
+ if(!is.numeric(mar)) mar <- marval
+ par(mar = mar,mgp = mgp,tcl = 0.3,las = las,xaxs = axs,yaxs = axs,cex = cex,lwd = lwd,col = col,fg = col, ...)
+ plot.new()
+ plot.window(xlim = xlim,ylim = ylim)
+ if(plot.box) box()
+ # Labels
+ if(is.null(xline)) xline <- mgp[1]
+ thermo.axis(xlab,side = 1,line = xline,cex = cex.axis,lwd = NULL)
+ if(is.null(yline)) yline <- mgp[1]
+ thermo.axis(ylab,side = 2,line = yline,cex = cex.axis,lwd = NULL)
+ # (optional) tick marks
+ if(1 %in% side) thermo.axis(NULL,side = 1,lwd = lwd, grid = grid, col.grid = col.grid, plot.line = !plot.box)
+ if(2 %in% side) thermo.axis(NULL,side = 2,lwd = lwd, grid = grid, col.grid = col.grid, plot.line = !plot.box)
+ if(3 %in% side) thermo.axis(NULL,side = 3,lwd = lwd, plot.line = !plot.box)
+ if(4 %in% side) thermo.axis(NULL,side = 4,lwd = lwd, plot.line = !plot.box)
+}
+
+# Function to add axes and axis labels to plots,
+# with some default style settings (rotation of numeric labels)
+# With the default arguments (no labels specified), it plots only the axis lines and tick marks
+# (used by diagram() for overplotting the axis on diagrams filled with colors).
+thermo.axis <- function(lab = NULL, side = 1:4,line = 1.5, cex = par('cex'), lwd = par('lwd'),
+ col = par('col'), grid = "", col.grid = "gray", plot.line = FALSE) {
+ if(!is.null(lwd)) {
+ for(thisside in side) {
+
+ ## 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(abs(diff(lim)) == 15) at <- seq(lim[1], lim[2], length.out = 6)
+ if(abs(diff(lim)) == 1.5) at <- seq(lim[1], lim[2], length.out = 4)
+ # 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
+ do.label <- TRUE
+ if(missing(side) | (missing(cex) & thisside %in% c(3,4))) do.label <- FALSE
+ # col and col.ticks: plot the tick marks but no line (we make it with box() in thermo.plot.new()) 20190416
+ # mat: don't plot ticks at the plot limits 20190416
+ if(thisside %in% c(1, 3)) pat <- par("usr")[1:2]
+ if(thisside %in% c(2, 4)) pat <- par("usr")[3:4]
+ mat <- setdiff(at, pat)
+ if(plot.line) axis(thisside, at = mat, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, col = col)
+ else axis(thisside, at = mat, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, col = NA, col.ticks = col)
+ # Plot only the labels at all major tick points (including plot limits) 20190417
+ if(do.label) axis(thisside, at = at, tick = FALSE, col = col)
+
+ ## Plot minor tick marks
+ # The distance between major tick marks
+ da <- abs(diff(at[1:2]))
+ # Distance between minor tick marks
+ di <- da / 4
+ 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)
+ myasp <- par('xaxp')
+ } else {
+ ii <- c(3,4)
+ myasp <- par('yaxp')
+ }
+ myusr <- par('usr')[ii]
+ daxis <- abs(diff(myusr))
+ nt <- daxis / di + 1
+ ## If nt isn't an integer, it probably
+ ## means the axis limits don't correspond
+ ## to major tick marks (expect problems)
+ ##at <- seq(myusr[1],myusr[2],length.out = nt)
+ # Start from (bottom/left) of axis?
+ bl <- 1
+ #if(myasp[2] == myusr[2]) bl <- 2
+ # Is forward direction (top/right)?
+ tr <- 1
+ if(xor(myusr[2] < myusr[1] , bl == 2)) tr <- -1
+ #at <- myusr[bl] + tr * di * seq(0:(nt-1))
+ # Well all of that doesn't work in a lot of cases,
+ # where none of the axis limits correspond to
+ # major tick marks. perhaps the following will work
+ at <- myusr[1] + tr * di * (0:(nt-1))
+ # Apply an offset
+ axt <- axTicks(thisside)[1]
+ daxt <- (axt - myusr[1])/di
+ daxt <- (daxt-round(daxt))*di
+ at <- at + daxt
+ ## Get the positions of major tick marks and make grid lines
+ if(grid %in% c("minor", "both") & thisside == 1) abline(v = at, col=col.grid, lty = 3)
+ if(grid %in% c("minor", "both") & thisside == 2) abline(h = at, col=col.grid, lty = 3)
+ tcl <- par('tcl') * 0.5
+ at <- setdiff(at, pat)
+ if(plot.line) axis(thisside, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, at = at, tcl = tcl, col = col)
+ else axis(thisside, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, at = at, tcl = tcl, col = NA, col.ticks = col)
+ }
+ }
+ # Rotate labels on side axes
+ for(thisside in side) {
+ if(thisside %in% c(2,4)) las <- 0 else las <- 1
+ if(!is.null(lab)) mtext(lab, side = thisside, line = line, cex = cex, las = las)
+ }
+}
+
Modified: pkg/CHNOSZ/R/util.plot.R
===================================================================
--- pkg/CHNOSZ/R/util.plot.R 2025-12-08 02:11:38 UTC (rev 941)
+++ pkg/CHNOSZ/R/util.plot.R 2025-12-08 03:39:36 UTC (rev 942)
@@ -1,42 +1,6 @@
# CHNOSZ/util.plot.R
-# Functions to create and modify plots
+# Utility functions for plots
-thermo.plot.new <- function(xlim,ylim,xlab,ylab,cex = par('cex'),mar = NULL,lwd = par('lwd'),side = c(1,2,3,4),
- mgp = c(1.7,0.3,0),cex.axis = par('cex'),col = par('col'),yline = NULL,axs = 'i',plot.box = TRUE,
- las = 1,xline = NULL, grid = "", col.grid = "gray", ...) {
- # Start a new plot with some customized settings
- thermo <- get("thermo", CHNOSZ)
- # 20120523 store the old par in thermo()$opar
- if(is.null(thermo$opar)) {
- thermo$opar <- par(no.readonly = TRUE)
- assign("thermo", thermo, CHNOSZ)
- }
- # 20090324 mar handling: NULL - a default setting; NA - par's setting
- # 20090413 changed mar of top side from 2 to 2.5
- marval <- c(3, 3.5, 2.5, 1)
- if(identical(mar[1], NA)) marval <- par("mar")
- # 20181007 get mar from the current device (if it exists) and par("mar") is not the default
- if(!is.null(dev.list())) {
- if(!identical(par("mar"), c(5.1, 4.1, 4.1, 2.1))) marval <- par("mar")
- }
- # Assign marval to mar if the latter is NULL or NA
- if(!is.numeric(mar)) mar <- marval
- par(mar = mar,mgp = mgp,tcl = 0.3,las = las,xaxs = axs,yaxs = axs,cex = cex,lwd = lwd,col = col,fg = col, ...)
- plot.new()
- plot.window(xlim = xlim,ylim = ylim)
- if(plot.box) box()
- # Labels
- if(is.null(xline)) xline <- mgp[1]
- thermo.axis(xlab,side = 1,line = xline,cex = cex.axis,lwd = NULL)
- if(is.null(yline)) yline <- mgp[1]
- thermo.axis(ylab,side = 2,line = yline,cex = cex.axis,lwd = NULL)
- # (optional) tick marks
- if(1 %in% side) thermo.axis(NULL,side = 1,lwd = lwd, grid = grid, col.grid = col.grid, plot.line = !plot.box)
- if(2 %in% side) thermo.axis(NULL,side = 2,lwd = lwd, grid = grid, col.grid = col.grid, plot.line = !plot.box)
- if(3 %in% side) thermo.axis(NULL,side = 3,lwd = lwd, plot.line = !plot.box)
- if(4 %in% side) thermo.axis(NULL,side = 4,lwd = lwd, plot.line = !plot.box)
-}
-
label.plot <- function(label, xfrac = 0.07, yfrac = 0.93, paren = FALSE, italic = FALSE, ...) {
# Make a text label e.g., "(a)" in the corner of a plot
# xfrac, yfrac: fraction of axis where to put label (default top right)
@@ -220,88 +184,9 @@
rev(dcol)[z]
}
-# Function to add axes and axis labels to plots,
-# with some default style settings (rotation of numeric labels)
-# With the default arguments (no labels specified), it plots only the axis lines and tick marks
-# (used by diagram() for overplotting the axis on diagrams filled with colors).
-thermo.axis <- function(lab = NULL, side = 1:4,line = 1.5, cex = par('cex'), lwd = par('lwd'),
- col = par('col'), grid = "", col.grid = "gray", plot.line = FALSE) {
- if(!is.null(lwd)) {
- for(thisside in side) {
-
- ## 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(abs(diff(lim)) == 15) at <- seq(lim[1], lim[2], length.out = 6)
- if(abs(diff(lim)) == 1.5) at <- seq(lim[1], lim[2], length.out = 4)
- # 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
- do.label <- TRUE
- if(missing(side) | (missing(cex) & thisside %in% c(3,4))) do.label <- FALSE
- # col and col.ticks: plot the tick marks but no line (we make it with box() in thermo.plot.new()) 20190416
- # mat: don't plot ticks at the plot limits 20190416
- if(thisside %in% c(1, 3)) pat <- par("usr")[1:2]
- if(thisside %in% c(2, 4)) pat <- par("usr")[3:4]
- mat <- setdiff(at, pat)
- if(plot.line) axis(thisside, at = mat, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, col = col)
- else axis(thisside, at = mat, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, col = NA, col.ticks = col)
- # Plot only the labels at all major tick points (including plot limits) 20190417
- if(do.label) axis(thisside, at = at, tick = FALSE, col = col)
-
- ## Plot minor tick marks
- # The distance between major tick marks
- da <- abs(diff(at[1:2]))
- # Distance between minor tick marks
- di <- da / 4
- 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)
- myasp <- par('xaxp')
- } else {
- ii <- c(3,4)
- myasp <- par('yaxp')
- }
- myusr <- par('usr')[ii]
- daxis <- abs(diff(myusr))
- nt <- daxis / di + 1
- ## If nt isn't an integer, it probably
- ## means the axis limits don't correspond
- ## to major tick marks (expect problems)
- ##at <- seq(myusr[1],myusr[2],length.out = nt)
- # Start from (bottom/left) of axis?
- bl <- 1
- #if(myasp[2] == myusr[2]) bl <- 2
- # Is forward direction (top/right)?
- tr <- 1
- if(xor(myusr[2] < myusr[1] , bl == 2)) tr <- -1
- #at <- myusr[bl] + tr * di * seq(0:(nt-1))
- # Well all of that doesn't work in a lot of cases,
- # where none of the axis limits correspond to
- # major tick marks. perhaps the following will work
- at <- myusr[1] + tr * di * (0:(nt-1))
- # Apply an offset
- axt <- axTicks(thisside)[1]
- daxt <- (axt - myusr[1])/di
- daxt <- (daxt-round(daxt))*di
- at <- at + daxt
- ## Get the positions of major tick marks and make grid lines
- if(grid %in% c("minor", "both") & thisside == 1) abline(v = at, col=col.grid, lty = 3)
- if(grid %in% c("minor", "both") & thisside == 2) abline(h = at, col=col.grid, lty = 3)
- tcl <- par('tcl') * 0.5
- at <- setdiff(at, pat)
- if(plot.line) axis(thisside, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, at = at, tcl = tcl, col = col)
- else axis(thisside, labels = FALSE, tick = TRUE, lwd = lwd, col.axis = col, at = at, tcl = tcl, col = NA, col.ticks = col)
- }
- }
- # Rotate labels on side axes
- for(thisside in side) {
- if(thisside %in% c(2,4)) las <- 0 else las <- 1
- if(!is.null(lab)) mtext(lab, side = thisside, line = line, cex = cex, las = las)
- }
+# To get hyphen instead of minus sign 20220630
+# https://stackoverflow.com/questions/10438398/any-way-to-disable-the-minus-hack-in-pdf-poscript-output
+hyphen.in.pdf <- function(x) {
+ # We only want to make the substitution in a pdf device (won't work in png, e.g. for knitr vignettes)
+ if(identical(names(dev.cur()), "pdf")) gsub("-", "\uad", x, fixed = TRUE) else x
}
Added: pkg/CHNOSZ/man/thermo.plot.Rd
===================================================================
--- pkg/CHNOSZ/man/thermo.plot.Rd (rev 0)
+++ pkg/CHNOSZ/man/thermo.plot.Rd 2025-12-08 03:39:36 UTC (rev 942)
@@ -0,0 +1,73 @@
+\encoding{UTF-8}
+\name{thermo.plot}
+\alias{thermo.plot}
+\alias{thermo.plot.new}
+\alias{thermo.axis}
+\title{Functions to create and modify plots}
+
+\description{
+ Initialize a new plot window using preset parameters or add an axis to a plot.
+}
+
+\usage{
+ thermo.plot.new(xlim, ylim, xlab, ylab, cex = par("cex"),
+ mar = NULL, lwd = par("lwd"), side = c(1,2,3,4),
+ mgp = c(1.7, 0.3, 0), cex.axis = par("cex"), col = par("col"),
+ yline = NULL, axs = "i", plot.box = TRUE, las = 1,
+ xline = NULL, grid = "", col.grid = "gray", ...)
+ thermo.axis(lab = NULL, side = 1:4, line = 1.5, cex = par("cex"),
+ lwd = par("lwd"), col = par("col"), grid = "", col.grid = "gray",
+ plot.line = FALSE)
+}
+
+\arguments{
+ \item{xlim}{numeric, limits of the \eqn{x}{x}-axis}
+ \item{ylim}{numeric, limits of the \eqn{y}{y}-axis}
+ \item{xlab}{character, \eqn{x}{x}-axis label}
+ \item{ylab}{character, \eqn{y}{y}-axis label}
+ \item{cex}{numeric, character expansion factor for labels}
+ \item{mar}{numeric, width (number of lines) of margins on each side of plot}
+ \item{lwd}{numeric, line width}
+ \item{side}{numeric, which sides of plot to draw axes}
+ \item{mgp}{numeric, sizes of margins of plot}
+ \item{cex.axis}{numeric, character expansion factor for names of axes}
+ \item{col}{character, color}
+ \item{yline}{numeric, margin line on which to plot \eqn{y}{y}-axis name}
+ \item{axs}{character, setting for axis limit calculation}
+ \item{plot.box}{logical, draw a box around the plot?}
+ \item{las}{numeric, style for axis labels}
+ \item{xline}{numeric, margin line on which to plot \eqn{x}{x}-axis name}
+ \item{grid}{character, type of grid (\samp{major}, \samp{minor}, or \samp{both})}
+ \item{col.grid}{character, color of the grid lines}
+ \item{...}{further arguments passed to \code{par}}
+ \item{lab}{character, axis label}
+ \item{line}{numeric, margin line on which to place axis label}
+ \item{plot.line}{logical, draw axis lines?}
+}
+
+\details{
+
+\code{thermo.plot.new} sets parameters for a new plot, creates a new plot using \code{\link{plot.new}}, and adds the axes tick marks to the plot.
+Plot parameters (see \code{\link{par}}) including \code{cex}, \code{mar}, \code{lwd}, \code{mgp} and \code{axs} can be given, as well as a numeric vector in \code{side} identifying which sides of the plot receive tick marks.
+\code{yline}, if present, denotes the margin line (default \code{\link{par}('mgp')[1]}) where the y-axis name is plotted.
+\code{thermo.axis} is the function that actually adds the axes, including inward-pointing major and minor tick marks (often used for thermodynamic property diagrams).
+
+Use \code{grid} to add a grid to the plot, corresponding to either the major ticks (solid lines), minor ticks (dashed lines), or both.
+The grid can be made by adding \code{grid} argument to \code{\link{diagram}}, or by calling \code{thermo.axis} after \code{diagram} (see example).
+
+}
+
+\seealso{
+\code{\link{diagram}} uses \code{thermo.plot.new} to set up a new plot, unless the argument \code{tplot} is set to FALSE in \code{diagram}.
+}
+
+\examples{
+# Start a new plot with specific settings
+thermo.plot.new(c(0, 10), c(0, 100), xlab = "X variable", ylab = "Y variable")
+
+# Add major and minor tick marks to an existing plot
+plot(1:10)
+thermo.axis()
+}
+
+\concept{Utility functions}
Modified: pkg/CHNOSZ/man/util.plot.Rd
===================================================================
--- pkg/CHNOSZ/man/util.plot.Rd 2025-12-08 02:11:38 UTC (rev 941)
+++ pkg/CHNOSZ/man/util.plot.Rd 2025-12-08 03:39:36 UTC (rev 942)
@@ -1,8 +1,6 @@
\encoding{UTF-8}
\name{util.plot}
\alias{util.plot}
-\alias{thermo.plot.new}
-\alias{thermo.axis}
\alias{label.plot}
\alias{usrfig}
\alias{label.figure}
@@ -9,21 +7,14 @@
\alias{water.lines}
\alias{mtitle}
\alias{ZC.col}
-\title{Functions to create and modify plots}
+\alias{hyphen.in.pdf}
+\title{Utility functions for plots}
\description{
- Initialize a new plot window using preset parameters, add an axis or title to a plot, generate labels for axes and subplots, add stability lines for water, get colors for a set of numeric values.
+ Label plots and figures, generate labels for axes and subplots, add stability lines for water, or get colors for a set of numeric values.
}
\usage{
- thermo.plot.new(xlim, ylim, xlab, ylab, cex = par("cex"),
- mar = NULL, lwd = par("lwd"), side = c(1,2,3,4),
- mgp = c(1.7, 0.3, 0), cex.axis = par("cex"), col = par("col"),
- yline = NULL, axs = "i", plot.box = TRUE, las = 1,
- xline = NULL, grid = "", col.grid = "gray", ...)
- thermo.axis(lab = NULL, side = 1:4, line = 1.5, cex = par("cex"),
- lwd = par("lwd"), col = par("col"), grid = "", col.grid = "gray",
- plot.line = FALSE)
label.plot(label, xfrac = 0.07, yfrac = 0.93, paren = FALSE,
italic = FALSE, ...)
usrfig()
@@ -33,55 +24,31 @@
lty = 2, lwd = 1, col = par("fg"), plot.it = TRUE)
mtitle(main, line = 0, spacing = 1, ...)
ZC.col(z)
+ hyphen.in.pdf(x)
}
\arguments{
- \item{xlim}{numeric, limits of the \eqn{x}{x}-axis}
- \item{ylim}{numeric, limits of the \eqn{y}{y}-axis}
- \item{xlab}{character, \eqn{x}{x}-axis label}
- \item{ylab}{character, \eqn{y}{y}-axis label}
- \item{cex}{numeric, character expansion factor for labels}
- \item{mar}{numeric, width (number of lines) of margins on each side of plot}
- \item{lwd}{numeric, line width}
- \item{side}{numeric, which sides of plot to draw axes}
- \item{mgp}{numeric, sizes of margins of plot}
- \item{cex.axis}{numeric, character expansion factor for names of axes}
- \item{col}{character, color}
- \item{yline}{numeric, margin line on which to plot \eqn{y}{y}-axis name}
- \item{axs}{character, setting for axis limit calculation}
- \item{plot.box}{logical, draw a box around the plot?}
- \item{las}{numeric, style for axis labels}
- \item{xline}{numeric, margin line on which to plot \eqn{x}{x}-axis name}
- \item{grid}{character, type of grid (\samp{major}, \samp{minor}, or \samp{both})}
- \item{col.grid}{character, color of the grid lines}
- \item{plot.line}{logical, draw axis lines?}
- \item{...}{further arguments passed to \code{par} or \code{mtext}}
- \item{lab}{character, axis label}
- \item{line}{numeric, margin line on which to place axis label or plot title}
\item{label}{character, label to place on plot}
\item{xfrac}{numeric, fractional location on \eqn{x}{x}-axis for placement of label}
\item{yfrac}{numeric, fractional location on \eqn{y}{y}-axis for placement of label}
\item{paren}{logical, add parentheses around label text?}
+ \item{...}{further arguments passed to \code{text} or \code{mtext}}
\item{italic}{logical, italicize label text?}
\item{eout}{data frame, output of \code{\link{affinity}}, \code{\link{equilibrate}}, or \code{\link{diagram}}}
\item{which}{character, which of oxidation/reduction lines to plot}
\item{lty}{numeric, line type}
+ \item{lwd}{numeric, line width}
+ \item{col}{character, color}
\item{plot.it}{logical, plot the lines?}
\item{main}{character, text for plot title}
+ \item{line}{numeric, margin line on which to place plot title}
\item{spacing}{numeric, spacing between multiple lines}
\item{z}{numeric, set of values}
+ \item{x}{character, any text object}
}
\details{
-\code{thermo.plot.new} sets parameters for a new plot, creates a new plot using \code{\link{plot.new}}, and adds the axes tick marks to the plot.
-Plot parameters (see \code{\link{par}}) including \code{cex}, \code{mar}, \code{lwd}, \code{mgp} and \code{axs} can be given, as well as a numeric vector in \code{side} identifying which sides of the plot receive tick marks.
-\code{yline}, if present, denotes the margin line (default \code{\link{par}('mgp')[1]}) where the y-axis name is plotted.
-\code{thermo.axis} is the function that actually adds the axes, including inward-pointing major and minor tick marks (often used for thermodynamic property diagrams).
-
-Use \code{grid} to add a grid to the plot, corresponding to either the major ticks (solid lines), minor ticks (dashed lines), or both.
-The grid can be made by adding \code{grid} argument to \code{\link{diagram}}, or by calling \code{thermo.axis} after \code{diagram} (see example).
-
\code{water.lines} plots lines representing the oxidation and reduction stability limits of water on Eh/pe/\logfO2/\logfH2 vs pH/\T/\P diagrams.
The x- and y-variables and their ranges are taken from \code{eout}.
Values of \T, \P, pH, and \logaH2O, not corresponding to either axis, are also taken from \code{eout}.
@@ -105,10 +72,9 @@
\code{ZC.col} uses \CRANpkg{colorspace} to generate colors from a diverging palette (red - light grey - blue) corresponding to the values in \code{z}.
Red is associated with lower values of \code{z}.
This function is intended to generate colors for distinguishing average oxidation state of carbon \code{\link{ZC}}, but any numeric values can be supplied.
-}
-\seealso{
-\code{\link{diagram}} uses \code{thermo.plot.new} to set up a new plot, unless the argument \code{tplot} is set to FALSE in \code{diagram}.
+If a PDF device is active, \code{hyphen.in.pdf} replaces all instances of ASCII hyphen (\verb{-}) in \code{x} with the Unicode hyphen (\verb{\uad}).
+This is done so that hyphens don't get displayed as minus signs in R graphics output, but it only works for the PDF device.
}
\examples{
More information about the CHNOSZ-commits
mailing list