[CHNOSZ-commits] r303 - in pkg/CHNOSZ: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jan 28 09:23:31 CET 2018
Author: jedick
Date: 2018-01-28 09:22:34 +0100 (Sun, 28 Jan 2018)
New Revision: 303
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/NAMESPACE
pkg/CHNOSZ/R/util.plot.R
pkg/CHNOSZ/inst/NEWS
pkg/CHNOSZ/man/util.plot.Rd
Log:
export thermo.axis()
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2018-01-28 07:16:39 UTC (rev 302)
+++ pkg/CHNOSZ/DESCRIPTION 2018-01-28 08:22:34 UTC (rev 303)
@@ -1,6 +1,6 @@
Date: 2018-01-28
Package: CHNOSZ
-Version: 1.1.3-10
+Version: 1.1.3-11
Title: Thermodynamic Calculations for Geobiochemistry
Authors at R: c(
person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),
Modified: pkg/CHNOSZ/NAMESPACE
===================================================================
--- pkg/CHNOSZ/NAMESPACE 2018-01-28 07:16:39 UTC (rev 302)
+++ pkg/CHNOSZ/NAMESPACE 2018-01-28 08:22:34 UTC (rev 303)
@@ -60,7 +60,7 @@
"calculateEpsilon", "calculateQ", "water.DEW", "berman",
"maxdiff", "expect_maxdiff", "Bdot",
# added 20171121 or later
- "dumpdata"
+ "dumpdata", "thermo.axis"
)
# Load shared objects
Modified: pkg/CHNOSZ/R/util.plot.R
===================================================================
--- pkg/CHNOSZ/R/util.plot.R 2018-01-28 07:16:39 UTC (rev 302)
+++ pkg/CHNOSZ/R/util.plot.R 2018-01-28 08:22:34 UTC (rev 303)
@@ -187,35 +187,16 @@
rev(dcol)[z]
}
-### unexported functions ###
-
# Function to add axes and axis labels to plots,
# with some default style settings (rotation of numeric labels)
-# and conversions between oxidation-reduction scales (called by thermo.plot.new ()).
# 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'),T=NULL,col=par('col')) {
- # if T isn't NULL, looks like we want make a second
- # oxidation scale corresponding to one already plotted.
- # e.g., Eh-pe, Eh-logfO2, or logfO2-Eh
- if(!is.null(T)) {
- usr <- par('usr')
- if(side %in% c(1,3)) lim <- usr[1:2] else lim <- usr[3:4]
- if(length(grep('pe',lab)) > 0) {
- lim <- convert(lim,'pe',T=T)
- } else if(length(grep('O2',lab)) > 0) {
- lim <- convert(lim,'logfO2',T=T)
- } else if(length(grep('Eh',lab)) > 0) {
- lim <- convert(lim,'E0',T=T)
- }
- if(side %in% c(1,3)) usr[1:2] <- lim else usr[3:4] <- lim
- opar <- par(usr=usr)
- }
+thermo.axis <- function(lab=NULL,side=1:4,line=1.5,cex=par('cex'),lwd=par('lwd'),col=par('col')) {
if(!is.null(lwd)) {
## plot major tick marks and numeric labels
for(thisside in side) {
do.label <- TRUE
- if(missing(side) | (missing(cex) & thisside %in% c(3,4) & is.null(T))) do.label <- FALSE
+ if(missing(side) | (missing(cex) & thisside %in% c(3,4))) do.label <- FALSE
at <- axis(thisside,labels=do.label,tick=TRUE,lwd=lwd,col=col,col.axis=col)
## plot minor tick marks
# the distance between major tick marks
@@ -263,6 +244,4 @@
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)
}
- # reset limits if we were plotting a second axis
- if(!is.null(T)) par(opar)
}
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2018-01-28 07:16:39 UTC (rev 302)
+++ pkg/CHNOSZ/inst/NEWS 2018-01-28 08:22:34 UTC (rev 303)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.3-10 (2018-01-28)
+CHANGES IN CHNOSZ 1.1.3-11 (2018-01-28)
---------------------------------------
- Lines in 1-D diagram()s can optionally be drawn as splines using the
@@ -25,6 +25,9 @@
- In equilibrate(), accept a length > 1 'normalize' argument in order
normalize the chemical formulas of only the selected species.
+- Export thermo.axis(), as it is useful for adding major&minor tick
+ marks after (above) other plot elements such as legends.
+
CHANGES IN CHNOSZ 1.1.3 (2017-11-13)
------------------------------------
Modified: pkg/CHNOSZ/man/util.plot.Rd
===================================================================
--- pkg/CHNOSZ/man/util.plot.Rd 2018-01-28 07:16:39 UTC (rev 302)
+++ pkg/CHNOSZ/man/util.plot.Rd 2018-01-28 08:22:34 UTC (rev 303)
@@ -2,6 +2,7 @@
\name{util.plot}
\alias{util.plot}
\alias{thermo.plot.new}
+\alias{thermo.axis}
\alias{label.plot}
\alias{usrfig}
\alias{label.figure}
@@ -20,6 +21,8 @@
mgp = c(1.7, 0.3, 0), cex.axis = par("cex"), col = par("col"),
yline = NULL, axs = "i", do.box = TRUE, las = 1,
xline = NULL, ...)
+ thermo.axis(lab = NULL, side = 1:4, line = 1.5, cex = par("cex"),
+ lwd = par("lwd"), col = par("col"))
label.plot(x, xfrac = 0.05, yfrac = 0.95, paren = FALSE,
italic = FALSE, ...)
usrfig()
@@ -49,6 +52,8 @@
\item{las}{numeric, style for axis labels}
\item{xline}{numeric, margin line on which to plot \eqn{x}{x}-axis name}
\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{x}{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}
@@ -59,14 +64,16 @@
\item{lty}{numeric, line type}
\item{plot.it}{logical, plot the lines?}
\item{main}{character, text for plot title}
- \item{line}{numeric, margin line to place title}
\item{spacing}{numeric, spacing between multiple lines}
\item{z}{numeric, set of values}
}
\details{
- \code{thermo.plot.new} sets parameters for a new plot, creates a new plot using \code{\link{plot.new}}, and adds axes and major and minor 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.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).
\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}.
@@ -93,4 +100,8 @@
}
+\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}.
+}
+
\concept{Utility functions}
More information about the CHNOSZ-commits
mailing list