util.plot: Functions to Create and Modify Plots

Description Usage Arguments Details Side Effects

Description

Initialize a new plot window using preset parameters, open a postcript file for plotting, add an axis or title to a plot, generate labels for plot axes and for identification of subplots and physical and chemical conditions, add stability lines for water to a diagram, get colors for set of values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
  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", do.box = TRUE, las = 1,
    xline = NULL, ...)
  thermo.axis(lab = NULL, side = 1:4, line = 1.5, cex = par("cex"),
    lwd = par("lwd"), T = NULL, col = par("col"))
  label.plot(x, xfrac = 0.05, yfrac = 0.95, paren = FALSE,
    italic = FALSE, ...)
  usrfig()
  label.figure(x, xfrac = 0.05, yfrac = 0.95, paren = FALSE,
    italic = FALSE, ...)
  water.lines(xaxis = "pH", yaxis = "Eh", T = 298.15, P = "Psat", 
    which = c("oxidation","reduction"), logaH2O = 0, lty = 2, lwd=1,
    col = par("fg"), xpoints = NULL, O2state="gas")
  mtitle(main, line=0, ...)
  ZC.col(z)

Arguments

xlim

numeric, limits of the x-axis

ylim

numeric, limits of the y-axis

xlab

character, x-axis label

ylab

character, y-axis label

cex

numeric, character expansion factor for labels

mar

numeric, width (number of lines) of margins on each side of plot

lwd

numeric, line width

side

numeric, which sides of plot to draw axes

mgp

numeric, sizes of margins of plot

cex.axis

numeric, character expansion factor for names of axes

col

character, line color

yline

numeric, margin line on which to plot y-axis name

axs

character, setting for axis limit calculation

do.box

logical, draw a box around the plot?

las

numeric, style for axis labels

xline

numeric, margin line on which to plot x-axis name

...

further arguments passed to par or mtext

lab

character, description of axis label

line

numeric, margin line to plot axis label

T

numeric, temperature (K)

x

character, label to place on plot

xfrac

numeric, fractional location on x-axis for placement of label

yfrac

numeric, fractional location on y-axis for placement of label

paren

logical, add parentheses around label text?

italic

logical, italicize label text?

xaxis

character, description of x-axis

yaxis

character, description of y-axis

P

numeric, pressure (bar)

which

character, which of oxidation/reduction lines to plot

logaH2O

numeric, logarithm of the activity of H2O

lty

numeric, line type

xpoints

numeric, points to plot on x axis

O2state

character, state of O2

main

character, text for plot title

z

numeric, set of values

Details

thermo.plot.new sets parameters for a new plot, creates a new plot using plot.new, and adds axes and major and minor tick marks to the plot. Plot parameters (see par) including cex, mar, lwd, mgp and axs can be given, as well as a numeric vector in side identifying which sides of the plot receive tick marks. yline, if present, denotes the margin line (default par('mgp')[1]) where the y-axis name is plotted. The very first time thermo.plot.new is called, it stores the existing value of par(no.readonly=TRUE) in thermo$opar so that the plot device can be reset to the previous state later on.

water.lines plots lines representing the oxidation and reduction stability limits of water on yaxis-xaxis diagrams, where yaxis can be Eh or O2, and xaxis can be pH or T. which controls which lines are drawn (oxidation, reduction, or both (the default)). logaH2O denotes the logarithm of the activity of water. With O2state set to gas (the default), the logarithm of oxygen fugacity is plotted. Change this to aq to plot the logarithm of oxygen activity (do not change it if plotting Eh). xpoints is an optional list of points on the x axis to which to restrict the plotting (default of NULL refers to the axis limits).

label.plot and label.figure add identifying text within the plot region and figure region. The value given for x is made into a label, optionally italicized and with parentheses (like (a)). The location of the label is controlled by xfrac and yfrac (the fractional coordinates of either the plot or figure region), and ... can include other parameters such as cex and adj that are passed to text.

usrfig returns the limits of the figure region in “user” coordinates (i.e. the limits of the plot region, from par("usr")). It is a supporting function for label.figure but is also useful for other circumstances where information must be added at a particular location in a figure.

thermo.axis is used 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). It also adds minor tick marks. With the default arguments (no labels specified), it plots only the axis lines and tick marks; this is useful for overplotting the axis on diagrams filled with colors.

mtitle can be used to add a multi-line title to a plot. It loops over each element of main and places it on a separate margin line using mtext. The spacing of the last (bottom) line from the edge of the plot is specified by line. This function exists to facilitate using expressions in multiline titles (see revisit for an example.)

ZC.col returns colors from a diverging palette (red - light grey - blue) corresponding to the values in z. Red is associated with lower values of z. This function is intended to generate colors for distinguishing average oxidation state of carbon ZC, but any numeric values can be supplied.

Side Effects

These functions create or modify a plot.



Search within the CHNOSZ package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.