util.plot | R Documentation |
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.
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(x, xfrac = 0.07, yfrac = 0.93, paren = FALSE,
italic = FALSE, ...)
usrfig()
label.figure(x, xfrac = 0.05, yfrac = 0.95, paren = FALSE,
italic = FALSE, ...)
water.lines(eout, which = c("oxidation","reduction"),
lty = 2, lwd = 1, col = par("fg"), plot.it = TRUE)
mtitle(main, line = 0, spacing = 1, ...)
ZC.col(z)
add.alpha(col, alpha)
xlim |
numeric, limits of the |
ylim |
numeric, limits of the |
xlab |
character, |
ylab |
character, |
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, color |
yline |
numeric, margin line on which to plot |
axs |
character, setting for axis limit calculation |
plot.box |
logical, draw a box around the plot? |
las |
numeric, style for axis labels |
xline |
numeric, margin line on which to plot |
grid |
character, type of grid (‘major’, ‘minor’, or ‘both’) |
col.grid |
character, color of the grid lines |
plot.line |
logical, draw axis lines? |
... |
further arguments passed to |
lab |
character, axis label |
line |
numeric, margin line on which to place axis label or plot title |
x |
character, label to place on plot |
xfrac |
numeric, fractional location on |
yfrac |
numeric, fractional location on |
paren |
logical, add parentheses around label text? |
italic |
logical, italicize label text? |
eout |
data frame, output of |
which |
character, which of oxidation/reduction lines to plot |
lty |
numeric, line type |
plot.it |
logical, plot the lines? |
main |
character, text for plot title |
spacing |
numeric, spacing between multiple lines |
z |
numeric, set of values |
alpha |
character, hexadecimal value of color transparency (alpha) |
thermo.plot.new
sets parameters for a new plot, creates a new plot using plot.new
, and adds the axes 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.
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 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 grid
argument to diagram
, or by calling thermo.axis
after diagram
(see example).
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 eout
.
Values of \T, \P, pH, and \logaH2O, not corresponding to either axis, are also taken from eout
.
which
controls which lines are drawn (‘oxidation’, ‘reduction’, or both (the default)).
The value of swapped
in the output reflects whether pH, \T, or \P is on the x-axis (TRUE) or y-axis (FALSE).
NA
is returned for any diagram for variables that can not be processed (including diagrams with more than 2 variables).
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.
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 expression
s in multiline titles.
ZC.col
uses colorspace) to generate 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.
add.alpha
adds transparency to a color by appending the value of alpha
to the hexadecimal representation of the color given in col
.
diagram
uses thermo.plot.new
to set up a new plot, unless the argument tplot
is set to FALSE in diagram
.
basis(c("H2S", "H2O", "H+", "e-"))
species(c("HS-", "H2S", "HSO4-", "SO4-2"))
a <- affinity(pH = c(0, 12), Eh = c(-1, 1), T = 200)
opar <- par(mfrow = c(2, 2))
diagram(a, grid = "both")
title(main = 'diagram(a, grid = "both")')
diagram(a, grid = "major")
title(main = 'diagram(a, grid = "major")')
diagram(a, grid = "minor")
title(main = 'diagram(a, grid = "minor")')
diagram(a, fill = "terrain")
thermo.axis(grid = "major", col.grid = "slategray")
title(main = 'thermo.axis(grid = "major")')
par(thermo()$opar)
par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.