Title: | Graphing Functions |
---|---|
Description: | Functions to create high-quality graphs to support statistical methods in water resources. These graphs meet or nearly meet the publication standards of the U.S. Geological Survey. |
Authors: | Dave Lorenz [aut], Laura DeCicco [cre] |
Maintainer: | Laura DeCicco <[email protected]> |
License: | CC0 |
Version: | 1.1.4.9000 |
Built: | 2024-10-24 03:13:33 UTC |
Source: | https://github.com/USGS-R/smwrGraphs |
Functions to create high-quality graphs.
These graphs meet or nearly meet
the publication standards for illustrations of the U.S. Geological Survey
(USGS) (U.S. Geological Survey, written commun., 2012). They are intended to
be a suite of integrated functions that make producing graphs and figures
relatively easy by passing much information about the plots between
functions so the user does not need to manage graphical information.
Package: | smwrGraphs |
Type: | Package |
License: | CC0 |
Depends: | smwrBase (>= 1.0.0), methods |
Imports: | KernSmooth, akima, lubridate |
Suggests: | smwrData (>= 1.0.0), dataRetrieval |
The functions in the smwrGraphs
package
are an integrated suite of functions that facilitate the production of
graphs that nearly meet USGS publication standards for illustrations (U.S.
Geological Survey, written commun., 2012). Those standards include line
weight, tick placement, labels, font size, and layout of the explanation.
The font used in production very closely matches the standard Univers
Condensed, and was selected because of its broad availability on many
computer platforms.
Use of base R
or other graphics functions can result in inconsistent
lineweights, font sizes and styles, and can require manual manipulation of
the explanation. The Programmer's Guide section in Lorenz (2015) shows
examples of calls to lower level graphics functions in base R
that produce consistent graphics products.
Functions to set up and initialize the smwrGraphs
environment:preSurface
setGD
setGraph
setKnitr
setLayout
setPDF
setPage
setPNG
setRStudio
setRtMargin
setSplom
setSweave
setTopMargin
Main plotting functions:areaPlot
biPlot
boxPlot
colorPlot
condition
contourPlot
corGram
dendGram
dotPlot
ecdfPlot
histGram
piperPlot
probPlot
qqPlot
reportGraph
scalePlot
seasonPlot
splomPlot
seriesPlot
stiffPlot
surfacePlot
ternaryPlot
timePlot
transPlot
xyPlot
condition
Functions to add features to a plot:addAnnotation
addArea
addAxisLabels
addCaption
addCI
addErrorBars
addExplanation
addGrid
addLabel
addMinorTicks
addPiper
addSLR
addSmooth
addStiff
addTable
addTernary
addTitle
addXY
labelPoints
refLine
Data Manipulation Functions for Graphs:cov2Ellipse
dataEllipse
hull
interpLine
paraSpline
# Color palettes:blueRed.colors
coolWarm.colors
greenRed.colors
pastel.colors
redBlue.colors
redGreen.colors
warmCool.colors
Selected Miscellaneous Functions:copyDemo
strip.blanks
Dave Lorenz
Lorenz, D.L., Diekoff, A.L, smwrGraphs—an R package for
graphing hydrologic data, version 1.1.2.
U.S. Geological Survey, 2012, Author'
s guide to standards for U.S.
Geological Survey page-size illustrations, 37 p.
https://pubs.er.usgs.gov/publication/ofr20161188
# For these examples, print to console .pager <- options("pager") options(pager="console") # See the demo for examples of how to use the functions in this library. demo(package="smwrGraphs") # A simple listing of the vignettes in this package: vignette(package="smwrGraphs") options(.pager)
# For these examples, print to console .pager <- options("pager") options(pager="console") # See the demo for examples of how to use the functions in this library. demo(package="smwrGraphs") # A simple listing of the vignettes in this package: vignette(package="smwrGraphs") options(.pager)
Adds text to a plot to annotate a feature.
addAnnotation(x, y, annotation, leaderx = NULL, leadery = NULL, leadercol = "black", angle = 0, justification = "left", size = 60 * par("csi"), position = "above", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
addAnnotation(x, y, annotation, leaderx = NULL, leadery = NULL, leadercol = "black", angle = 0, justification = "left", size = 60 * par("csi"), position = "above", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-axis placement of |
y |
the y-axis placement of |
annotation |
the text. Can be either a character string or an "expression" object. |
leaderx |
draw leader from |
leadery |
draw leader from |
leadercol |
the color of the leader. |
angle |
the angle to rotate the text. |
justification |
the justification of the text relative to |
size |
size of the text in points, the default is the current point size. |
position |
the vertical location of the text. Must be one of "above," "below," or "center." |
current |
the current plot controls. Typically, this would be the
output from one of the graph creation functions like |
This function places only a single annotation string on the graph for
each call.
A leader from x
, y
to leaderx
,
leadery
if leaderx
is not NULL
.
The current plot information is returned invisibly.
## Not run: set.seed(12) X <- rnorm(12) Y <- X + rnorm(12) # make an outlier X[1L] <- 1.5 setGD() AA.pl <- xyPlot(X, Y) # label the outlier addAnnotation(X[1L], Y[1L], "Outlier", current=AA.pl) # For more details of addAnnotation see vignette(topic="GraphAdditions", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(12) X <- rnorm(12) Y <- X + rnorm(12) # make an outlier X[1L] <- 1.5 setGD() AA.pl <- xyPlot(X, Y) # label the outlier addAnnotation(X[1L], Y[1L], "Outlier", current=AA.pl) # For more details of addAnnotation see vignette(topic="GraphAdditions", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)
Adds a filled polygon (area) to a graph.
addArea(x, y, ybase = NULL, Area = list(name = "", color = "gray", outline = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
addArea(x, y, ybase = NULL, Area = list(name = "", color = "gray", outline = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-axis coordinates of the polygon. Missing values are not permitted. |
y |
the y-axis coordinates of the polygon. Missing values are not permitted. |
ybase |
the y-axis coordinates of the polygon. See Details. Missing values are not permitted. |
Area |
parameters defining the characteristics of the area. See
|
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
If ybase
is NULL, then x
and y
should form a complete
polygon, which can be closed or open. Otherwise, ybase
can be a single
value in which case the area between ybase
and y
is treated as
the area, or ybase
can be a vector as long as y
and the area
between is treated as the area to be shaded.
The current plot information is returned invisibly.
## Not run: set.seed(1) X <- seq(1, 9, by=.5) Y <- runif(17) + runif(17) setGD() AA.pl <- xyPlot(X, Y, Plot=list(what="none")) addArea(X, Y, ybase=0, current=AA.pl) # For more details of addArea see vignette(topic="GraphSetup", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- seq(1, 9, by=.5) Y <- runif(17) + runif(17) setGD() AA.pl <- xyPlot(X, Y, Plot=list(what="none")) addArea(X, Y, ybase=0, current=AA.pl) # For more details of addArea see vignette(topic="GraphSetup", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") ## End(Not run)
Adds axis ticks, labels, and title to a graph.
addAxisLabels(which, current, title = "", ticks = FALSE, labels = TRUE)
addAxisLabels(which, current, title = "", ticks = FALSE, labels = TRUE)
which |
which axis to label, must be one of "bottom," "left," "top," or "right." |
current |
a list containing the current plot information, see Details. |
title |
the axis title. |
ticks |
draw the ticks. |
labels |
draw the labels. |
The current
argument is generally the output from a high-level
plotting function in smwrGraphs
. If which
is "left" or "right,"
then current
must contain a component named yax
. If which
is
"bottom" or "top," then current
must containa component named xax
.
Those components are generally constructed from functions like linearPretty
or
or logPretty
.
The current plot information is returned invisibly.
In general, all functions that create plots will draw the necessary axes. This function should be used only to add axis labels to an unlabeled axis. Axis labels can be suppressed by setting up the margins with negative values.
linearPretty
, logPretty
,
datePretty
, transPretty
, addLabel
## Not run: set.seed(1) X <- runif(25) Y <- runif(25) AA.pl <- xyPlot(X, Y) addAxisLabels("top", AA.pl, labels=TRUE) # For more details of addAxisLabels see vignette(topic="GraphSetup", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- runif(25) Y <- runif(25) AA.pl <- xyPlot(X, Y) addAxisLabels("top", AA.pl, labels=TRUE) # For more details of addAxisLabels see vignette(topic="GraphSetup", package="smwrGraphs") ## End(Not run)
Creates a bar chart by adding bars to an existing graph.
addBars(x, y, base = 0, Bars = list(name = "Auto", fill = "gray80", outline = "black", width = "Auto", orientation = "stack"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
addBars(x, y, base = 0, Bars = list(name = "Auto", fill = "gray80", outline = "black", width = "Auto", orientation = "stack"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-coordinate data. Missing values are permitted but result in no bar. |
y |
the heights of the bars or y-coordinate data. Missing values are
permitted but result in no bar. For stacked or grouped bars, |
base |
extend the bars from this value. |
Bars |
parameters defining the characteristics of the bars. See Details. |
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
The Bars
argument must be a tagged list with these components:
a character vector describing each column of data; used in the
explanation. If "Auto," then derive the name from the column names in y
.
the name of the color to fill each bar. For multiple bars, can be a vector of colors or the name of a color sequence generating function, such as "pastel.colors."
the name of the color to draw the outline or border for each bar. If "none," then no border is drawn.
the width of each bar in x-axis units. For discrete x-axis,
If width
1, then the bars form a continuous filled area.
The default is "Auto," which fills 2/3 of the distance. If 0, then draw vertical
lines rather than bars; the color of the line is based on outline
.
the orientation of the bars. Must be either "stack" or "group." Can be abbreviated to a single letter.
The current plot information is returned invisibly.
Use of addBars
adds 1 step to creating bar charts, but adds
flexibility in axis formatted from existing high-level plotting functions such
as xyPlot
or timePlot
.
Bars are only valid for linear y-axes. Calling addBars
when
yaxis.log
or yaxis.rev
is TRUE
or for any arbitrary
transform of the y-axis will cause addBars
to fail.
Datasets containing grouped data are often stacked with a column indicating the grouping.
There are several functions that will reformat stacked datasets. The group2row
function is very flexible in accepting many types of data to reformat rather than
only numeric data.
xyPlot
, timePlot
, addXY
group2row
## Not run: set.seed(1) X <- seq(1, 9, by=1.0) Y <- runif(9) + runif(9) setGD() AA.pl <- xyPlot(X, Y, Plot=list(what="none"), yaxis.range=c(0,2)) addBars(X, Y, base=0, current=AA.pl) # For more details of addBars see demo(topic="AnnualFlowBarChart", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- seq(1, 9, by=1.0) Y <- runif(9) + runif(9) setGD() AA.pl <- xyPlot(X, Y, Plot=list(what="none"), yaxis.range=c(0,2)) addBars(X, Y, base=0, current=AA.pl) # For more details of addBars see demo(topic="AnnualFlowBarChart", package="smwrGraphs") ## End(Not run)
Adds a caption at the bottom of the graph.
addCaption(caption = "")
addCaption(caption = "")
caption |
the text of the caption for the graph |
Nothing is returned.
Useful for adding 1-line captions.
## Not run: set.seed(1) X <- runif(25) Y <- runif(25) setGD() AA.pl <- xyPlot(X, Y) addCaption("Twenty five random points") # See for examples of addCaption: vignette(topic="GraphSetup", package="smwrGraphs") demo(topic="AnnualFlowBarChart", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- runif(25) Y <- runif(25) setGD() AA.pl <- xyPlot(X, Y) addCaption("Twenty five random points") # See for examples of addCaption: vignette(topic="GraphSetup", package="smwrGraphs") demo(topic="AnnualFlowBarChart", package="smwrGraphs") ## End(Not run)
Adds confidence interval lines to a simple linear regression or q-normal graph.
addCI(type, level = 0.95, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
addCI(type, level = 0.95, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
type |
the type of confidence interval desired. Must be either "SLR" for the confidence
interval for a simple linear regression model, which must have been created using the
|
level |
the confidence level desired. |
Plot |
parameters defining the characteristics of the plot. See
|
current |
the current plot information, normally the output from a high-level
graphics function like |
The current plot information, the x and y components are the data, not the line. The regression model is included as the lm component.
The equation for the confidence intervals for a simple linear regression
model can be found in any textbook on regression, see section 9.4.4 in Helsel and
Hirsch (2002) for example.
The confidence interval for a normal distribution is described in Appendix 9 in
U.S. Water Resources Council (1982). Owen (1968) describes the application of the
noncentral t-distribution for computing the tolerance limits for a normal
distribition.
Helsel, D.R., and Hirsch, R.M., 2002, Statistical methods in water resources:
U.S. Geological Survey Techniques of Water-Resources Investigations, book 4,
chap. A3, 522 p.
U.S. Water Resources Council, 1982, Guidelines for determining flood flow frequency,
revised September 1981, Editorial Corrections March 1982:
Hydrology Committee Bulletin 17B, Washington D.C., 190 p., 1 plate.
## Not run: set.seed(1) X <- rnorm(32) setGD() AA.pl <- qqPlot(X) addCI("q-norm", current=AA.pl) # For more details of addCI see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) setGD() AA.pl <- qqPlot(X) addCI("q-norm", current=AA.pl) # For more details of addCI see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Adds upper-lower error bars to data in a graph.
addErrorBars(x, yup, ylo, Bars = list(name = "", cap = 0.09, width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
addErrorBars(x, yup, ylo, Bars = list(name = "", cap = 0.09, width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-coordinate data. Missing values are permitted but result in no bar. |
yup |
the upper limit of the error bar. Missing values are permitted but result in no bar. |
ylo |
the lower limit of the error bar. Missing values are permitted but result in no bar. |
Bars |
parameters defining the characteristics of the error bars. See Details. |
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
The Bars
argument must be a tagged list with these components:
a name describing the data; used in the explanation.
the width of each cap on the error bar.
the width of the lines drawn for the error bars.
the name of the color to draw the error bars.
The current plot information is returned invisibly.
The error bars are plotted on top of any current symbol. To plot the
symbol on top of the error bar, start with the argument
Plot=list(what="none")
in the original call to xyPlot
or
timePlot
and then add the symbols with a call to addXY
. Note
that this is only necessary if the color of the symbol and the color of the
error bars are different.
The symbol drawn for errors bars in the explantion does not have caps due to a
limitation in the system for creating the explanation.
xyPlot
, timePlot
, addXY
,
xyPlot
## Not run: set.seed(1) X <- seq(1, 9, by=1.0) Y1 <- runif(9) Y2 <- runif(9) Y <- (Y1 + Y2)/2 Ymin <- pmin(Y1, Y2) Ymax <- pmax(Y1, Y2) setGD() AA.pl <- xyPlot(X, Y, yaxis.range=c(0,1)) addErrorBars(X,Ymax, Ymin) # For more details of addErrorBars see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- seq(1, 9, by=1.0) Y1 <- runif(9) Y2 <- runif(9) Y <- (Y1 + Y2)/2 Ymin <- pmin(Y1, Y2) Ymax <- pmax(Y1, Y2) setGD() AA.pl <- xyPlot(X, Y, yaxis.range=c(0,1)) addErrorBars(X,Ymax, Ymin) # For more details of addErrorBars see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Creates or adds an explanation, also called key or legend.
addExplanation(what, where = "new", title = expression(bold(EXPLANATION)), box.off = where != "new", margin = rep(0, 4), line.length = 2, line.height = 1.1)
addExplanation(what, where = "new", title = expression(bold(EXPLANATION)), box.off = where != "new", margin = rep(0, 4), line.length = 2, line.height = 1.1)
what |
a specialized object for an explanation, from the output from calls to the plotting functions |
where |
a description of where to put the explanation, see Details. |
title |
the title of the explanation. |
box.off |
logical, if |
margin |
the margin for a new graph |
line.length |
the relative length of lines drawn in the explanation, see Details. |
line.height |
the relative spacing of the lines in the explanation. |
The value for where
must be one of "ul," "ur," "ll," "lr,"
"cl," "cr," "uc," "lc,"
"cc," or "new." If "new," then the explanation is placed in a new graph,
otherwise, the first letter is an abbreviation for upper, lower, or center
and the second letter is an abbreviation for left, right, or center. the
explanation for a box plot, stiff diagram, or contour plot must be placed
in a new graph. If box.off
is TRUE
, then the explanation abuts
the axes, otherwise it is placed slightly inset so that the text does not
interfere with the ticks.
In most cases, line.length
does not need to be changed. In some cases,
such as mass produced figures that will not be modified by an illustrator, the
line.length
can be increased to show full dashes if dashed lines are
drawn. In gneralt, the illustrator should create dashed lines rather than drawing
them in the graph.
Nothing is returned.
The call to addExplanation
should be the last in any sequence of
calls to construct a figure becuase it can alter some graphical parameters.
Box plot explanations require fairly large graph areas because of the
detail required for some types. In general, a graph about 4.5 inches high is
needed for the Tukey type and 4 inches for other types and widths of 2.5 and
2 inches respectively. The sizes are smaller for the font type of "USGS."
If the graph area is smaller than required for the box plot explanation, then
either a modified explanation is created or a warning is printed and the
explanation may be unreadable.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y, Plot=list(name="Random Points")) addExplanation(AA.pl, where='ul') # For more details of addExplanation see vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y, Plot=list(name="Random Points")) addExplanation(AA.pl, where='ul') # For more details of addExplanation see vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") ## End(Not run)
Adds grid lines to a graph.
addGrid(current, Xgrid = list(grid = "gray50", finegrid = "none"), Ygrid = list(grid = "gray50", finegrid = "none"))
addGrid(current, Xgrid = list(grid = "gray50", finegrid = "none"), Ygrid = list(grid = "gray50", finegrid = "none"))
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
Xgrid |
parameters defining the characteristics of the x-axis grid
lines. The components refer to the color to draw the |
Ygrid |
parameters defining the characteristics of the y-axis grid
lines. The components refer to the color to draw the |
Information about grid lines is contained in the information returned from high-level plotting functions in the smwrGraphs package.
NULL is returned invisibly.
The function addGrid
should be used after
setting up a graph with one of the main plotting functions in the smwrGraphs
package and setting the what
component in the Plot
argument to
"none." The graph can be completed by using addXY
.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y, Plot=list(what="none")) # Grid first, then data to avoid over plotting addGrid(AA.pl) addXY(X, Y, Plot=list(what="points")) # For more details of addGrid see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y, Plot=list(what="none")) # Grid first, then data to avoid over plotting addGrid(AA.pl) addXY(X, Y, Plot=list(what="points")) # For more details of addGrid see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Adds text in the margin for specialized axis labels.
addLabel(label, x, side = "bottom", size = "Auto", distance = 0.2, justification = "center", orientation = "parallel", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
addLabel(label, x, side = "bottom", size = "Auto", distance = 0.2, justification = "center", orientation = "parallel", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
label |
the text or expression to add to the graph. |
x |
the axis location in the correct user units. |
side |
the side to place |
size |
the size of the text in points. |
distance |
the distance from the axis, in lines of text. |
justification |
defines the placement of the text relative to |
orientation |
the orientation of the label relative to the axis. Must be either "parallel" or "perpendicular." |
current |
the current plot parameters. Typically, this would be the
output from one of the graph creation functions like |
Nothing is returned.
In general, all functions that create plots will draw the necessary
axes. This function should be used only to add axis labels to an unlabeled
axis. Axis labels can be suppressed by setting up the margins with negative
values or, for some functions, special arguments to xlabels
or
ylabels
.
addAxisLabels
,
mtext
and plotmath
for example expressions,
## Not run: set.seed(1) X <- as.POSIXct(c("2010-12-22 10:30", "2010-12-28 13:45", "2011-01-05 9:30", "2011-01-07 14:50")) Y <- runif(4) setGD() AA.pl <- timePlot(X, Y, Plot=list(what="points")) # Insert verical bar between years addLabel("|", as.Date("2011-01-01"), distance=1.2) # For more details of addLabel see vignette(topic="GraphGallery", package="smwrGraphs") demo(topic="AnnualFlowBarChart", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- as.POSIXct(c("2010-12-22 10:30", "2010-12-28 13:45", "2011-01-05 9:30", "2011-01-07 14:50")) Y <- runif(4) setGD() AA.pl <- timePlot(X, Y, Plot=list(what="points")) # Insert verical bar between years addLabel("|", as.Date("2011-01-01"), distance=1.2) # For more details of addLabel see vignette(topic="GraphGallery", package="smwrGraphs") demo(topic="AnnualFlowBarChart", package="smwrGraphs") ## End(Not run)
Adds minor axis ticks to a graph.
addMinorTicks(which, current, ticks)
addMinorTicks(which, current, ticks)
which |
which axis to label, must be one of "bottom," "left," "top," or
"right," "x," or "y." If |
current |
the current plot information, see Details. |
ticks |
the number of minor ticks to draw. If missing, then the default number is used, see Details. |
The current
argument must contain a component named yax
if
which
is "left" or "right" or a component named xax
if
which
is "bottom" or "top." Those arguments are generally constructed
from functions like linearPretty
.
The default placement of minor ticks is at the largest unit that lies between the major ticks—if the difference between major ticks is an even multiple of 2 or 5, then the minor interval will be that even multiple of 1, otherwise it will be 1/10 that even multiple.
The current plot information is returned invisibly.
In general, this should be used only with linear axes. Other axis types can result in unexpected results.
linearPretty
, addAxisLabels
,
addLabel
## Not run: set.seed(1) X <- runif(25, .5, 9.5) Y <- runif(25) setGD() AA.pl <- xyPlot(X, Y) addMinorTicks("bottom", AA.pl) addMinorTicks("top", AA.pl) # For more details of addMinorTicks see vignette(topic="DateAxisFormats", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- runif(25, .5, 9.5) Y <- runif(25) setGD() AA.pl <- xyPlot(X, Y) addMinorTicks("bottom", AA.pl) addMinorTicks("top", AA.pl) # For more details of addMinorTicks see vignette(topic="DateAxisFormats", package="smwrGraphs") ## End(Not run)
Adds points or lines to a Piper plot.
addPiper(xCat, yCat, zCat, xAn, yAn, zAn, xPip, yPip, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list())
addPiper(xCat, yCat, zCat, xAn, yAn, zAn, xPip, yPip, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list())
xCat |
, |
yCat |
, and |
zCat |
the cations for the x-, y-, and z-axes. Need not sum to 1 or 100. See Details. |
xAn |
, |
yAn |
, and |
zAn |
the anions for the x-, y-, and z-axes. Need not sum to 1 or 100. See Details. |
xPip |
, and |
yPip |
the coordinates for the internal piper diagram. See Details. |
Plot |
parameters defining the characteristics of the plot. See
|
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
The values for xCat
, yCat
, zCat
, xAn
,
yAn
, and zAn
should match the constituents in the original
call to piperPlot
. The units should be in milli-equivalents if all
three components are used to add to the Piper plot.
There are two ways to add to a Piper plot, the first way is to specify new data
by supplying values for xCat
, yCat
, zCat
, xAn
,
yAn
, and zAn
. In this case the data for the central middle (Piper)
plot are generated from those data and the xPip
, yPip
arguments
will be ignored. The other way is to use processed values from an already created
Piper plot to add details to the plot, either customized symbols or closed lines
showing groups for example. The vignette PiperPlot shows an example of customized
symbols.
Information about the graph.
## Not run: # See for examples of addPiper: vignette(topic="PiperPlot", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of addPiper: vignette(topic="PiperPlot", package="smwrGraphs") ## End(Not run)
Adds a simple linear regression line to a scatter plot.
addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...) ## Default S3 method: addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...) ## S3 method for class 'list' addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...)
addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...) ## Default S3 method: addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...) ## S3 method for class 'list' addSLR(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), Model = list(x = "", y = "", form = "exp", where = "none"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), ...)
x |
the x-axis data. For method |
y |
the y-axis data. Missing values are permitted but omitted. |
Plot |
parameters defining the characteristics of the plot. See
|
Model |
parameters for displaying the simple linear regression model. See Details. |
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
... |
not used, required for other methods. |
The Model
argument sets up the information to include the regression
model equation on the graphs. Within Model
, x
is the name to use for the
explanatory variable, y
is the name to use for the response variable, form
indicates the form that the regression model should take if the variable are log
transformed; "exp" indicates that the model equation should be expressed as an exponent,
any other string indicates thet the model should be expressed using the transformation
functions; and where
indicates where to place the equation. The value for
where
is a two letter code based on "upper," "center," or "lower" and "right,"
"center," or "left"—for example "ul" would place the model equaiton in the upper left
corner.
The current plot information, the x and y components are the data, not the line. The regression model is included as the lm component.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addSLR(AA.pl) # For more details of addSLR see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addSLR(AA.pl) # For more details of addSLR see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Adds a smoothed line to a scatter plot.
addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE)) ## Default S3 method: addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE)) ## S3 method for class 'list' addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE)) ## Default S3 method: addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE)) ## S3 method for class 'list' addSmooth(x, y, Smooth = "loess.smooth", ..., Smooth.along = "x", Plot = list(name = "", what = "lines", type = "solid", width = "standard", color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-axis data. For method |
y |
the y-axis data. Missing values are permitted and ignored in the smooth. |
Smooth |
the name of the smoothing function. See Details. |
... |
additional parameters for the function names in |
Smooth.along |
the data along which the smoother is run. Must be either "x,"
which smooths |
Plot |
parameters defining the characteristics of the plot. See
|
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
The value for Smooth
must the name of a smoothing function as a
character string. The default is "loess.smooth" but any smoother that accepts arguments
names x
and y
and other arguments controlling the smooth and returns a list
with components named x
and y
can be used. Examples of other smoothers in base
R are "supsmu" and "smooth.spline."
The current plot information.
If an error is generated from the smoother, then nothing is added to the graph, an error is printed, the returned object contains missing values for the data that should have been plotted, and the explanation is not updated.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addSmooth(AA.pl) # For more details of addSmooth see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addSmooth(AA.pl) # For more details of addSmooth see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Adds a small table to a graph.
addTable(tbl, where = "ll", title = "")
addTable(tbl, where = "ll", title = "")
tbl |
the data frame or matrix to add to graph. All data must be of mode character, which allows the user to format the data rather than the automatic formatting done by R. |
where |
character specifying the corner the table should be placed, see Details. |
title |
the title of the table. |
where
must be one of "ul," "ur," "ll," or "lr." The first letter is
an abbreviation for upper or lower, the second letter is an abbreviation for
left or right.
Nothing is returned.
Each column of the table can be formatted by the user, using the
format
function, to control the alingment of the data in each column
of the table. The column names of the table are the column names of
the matrix or data frame. If there are no column names in a matrix, then the
table is printed without column names. A matrix gives the user more control over
column names than does a data frame.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) Mat <- cbind(c("Mean of X", "Mean of Y"), round(c(mean(X), mean(Y)), 2)) addTable(Mat, "ul") # For more details of addTable see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) Mat <- cbind(c("Mean of X", "Mean of Y"), round(c(mean(X), mean(Y)), 2)) addTable(Mat, "ul") # For more details of addTable see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Adds points or lines to a Ternary diagram.
addTernary(x, y, z, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list())
addTernary(x, y, z, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list())
x |
the x-axis (bottom) data. Missing values are permitted, but result in breaks in the plotted data. |
y |
the y-axis (left side) data. Missing values are permitted, but result in breaks in the plotted data. |
z |
the z-axis (right side) data. Note that |
Plot |
parameters defining the characteristics of the plot. See
|
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
Information about the graph.
## Not run: # See for examples of addTernary: vignette(topic="PiperPlot", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of addTernary: vignette(topic="PiperPlot", package="smwrGraphs") ## End(Not run)
Adds a title (also called heading) to a graph.
addTitle(Main = "", Heading = "", Justification = "left", Bold = TRUE, Position = "above")
addTitle(Main = "", Heading = "", Justification = "left", Bold = TRUE, Position = "above")
Main |
the main text of the title. Can be either a character string or an
"expression" object. If |
Heading |
The title heading, generally a single letter. See Details |
Justification |
specify the horizontal location of the title, must be one of "left," "center," or "right." |
Bold |
logical, if |
Position |
specify the vertical location of the title, must be either "above" or "inside." |
If only Heading
is non blank, then the title is a single letter in
bold italics. If both Heading
and Main
are non blank, then the
title is a single letter followed by a period in bold italics followed by
Main
in bold if Bold
is TRUE
.
Nothing is returned.
addCaption
, addAnnotation
,
addTable
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addTitle("X and Y") # For more details of addTitle see vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y) addTitle("X and Y") # For more details of addTitle see vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") ## End(Not run)
Adds points or lines to the current graph.
addXY(x, y, ...) ## S4 method for signature 'ANY,numeric' addXY(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), new.axis = "none", new.log = FALSE, new.rev = FALSE, new.range = c(NA, NA), new.labels = 7, new.title = "") ## S4 method for signature 'numeric,character' addXY(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), jitter.y = FALSE)
addXY(x, y, ...) ## S4 method for signature 'ANY,numeric' addXY(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), new.axis = "none", new.log = FALSE, new.rev = FALSE, new.range = c(NA, NA), new.labels = 7, new.title = "") ## S4 method for signature 'numeric,character' addXY(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), jitter.y = FALSE)
x |
the x-axis data. Missing values are permitted, but result in breaks in the plotted data. |
y |
the y-axis data. Missing values are permitted, but result in breaks in the plotted data. |
... |
arguments for specific methods. |
Plot |
parameters defining the characteristics of the plot. See
|
current |
the current plot information. Typically, this would be the
output from one of the graph creation functions like |
new.axis |
character: indicating which new axis to set up. Must be either "right," "top," or "none," which indicates that the existing axes be used (default). |
new.log |
logical, if |
new.rev |
logical, if |
new.range |
set new-axis range. |
new.labels |
set up new-axis labels. |
new.title |
the new-axis title. |
jitter.y |
adjust |
Information about the graph.
Any valid x-axis data and numeric y.
Method to add to a dot plot; the right-axis arguments are not valid.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) Y2 <- X + rnorm(32, sd=0.5) setGD() AA.pl <- xyPlot(X, Y) addXY(X, Y2, Plot=list(what="points", color="brown")) # See for examples of addXY: vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="ProbabilityPlots", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") demo(topic="MeasurementRating", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) Y2 <- X + rnorm(32, sd=0.5) setGD() AA.pl <- xyPlot(X, Y) addXY(X, Y2, Plot=list(what="points", color="brown")) # See for examples of addXY: vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="ProbabilityPlots", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") demo(topic="MeasurementRating", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)
Produces a plot where the area between lines is filled with color.
areaPlot(x, y, Areas = list(name = "Auto", fillDir = "between", base = "Auto", lineColor = "black", fillColors = "pastel"), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA))
areaPlot(x, y, Areas = list(name = "Auto", fillDir = "between", base = "Auto", lineColor = "black", fillColors = "pastel"), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA))
x |
numeric x-axis coordinates in increasing order. |
y |
a numeric matrix of y-axis coordinates. |
Areas |
parameters controlling the areas. See Details. |
yaxis.log |
logical, if |
yaxis.range |
set y-axis range. See Details. |
xaxis.log |
logical, if |
xaxis.range |
set x-axis range. See Details. |
ylabels |
set up y-axis labels. See |
xlabels |
set up x-axis labels. See |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the caption for the graph. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
The components of Areas
are name
, the name or names
to use to describe the areas in the explanation, the default "Auto" generates
names from the column names of y
; fillDir
, how to
fill—must be either "between" or "under;" base
, the base value when
fillDir
is "under," can be "Auto" to draw to the x-axis or any numeric value;
lineColor
specifies the color to draw the lines around each area, may be
"none" for no line drawn; fillColors
specifies colors for each area, when only
a single area is drawn, then the value must be the name of a color, otherwise either a
vector of colornames or the prefix name of a function that generates a sequence of
colors. The prefix name is prepended to ".colors" for the name of the function. See the
documentation for these functions in the See Also section.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
addArea
, smwr.colors
,
heat.colors
## Not run: set.seed(1) X <- seq(1, 9, by=.5) Y <- runif(17) + runif(17) setGD() # The default fillDir, between, requires at least a 2-column matrix areaPlot(X, cbind(rep(0, 17),Y)) # For more details of areaPlot see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- seq(1, 9, by=.5) Y <- runif(17) + runif(17) setGD() # The default fillDir, between, requires at least a 2-column matrix areaPlot(X, cbind(rep(0, 17),Y)) # For more details of areaPlot see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Produces a biplot, which is a plot of two different types of data on the same graph.
biPlot(x, ...)
biPlot(x, ...)
x |
any object which has a valid method for |
... |
additional arguments for other methods. |
Information about the graph
A call should be made to setPage
to set up the graphics
environment before calling biPlot
.
setPage
, biPlot.default
,
biPlot.princomp
## Not run: # See for examples of biPlot: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of biPlot: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Produces a biplot, which is a plot of two different types of data on the same graph.
## Default S3 method: biPlot(x, y, separate.axes = TRUE, xPlot = list(name = "observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), yPlot = list(name = "variables", width = "color", size = 0.2, color = "darkblue", symbol = "arrow", filled = FALSE), xPlotLabels = list(labels = "rownames", dir = "NE", size = 8, offset = 0.35), yPlotLabels = list(labels = "colnames", dir = "Auto", size = 8, offset = 0.35, color = "darkblue"), ylabels = 5, xlabels = 5, ylabels2 = 5, xlabels2 = 5, xtitle = "", ytitle = "", xtitle2 = "", ytitle2 = "", range.factor = 1.25, caption = "", margin = c(NA, NA, NA, NA), ...)
## Default S3 method: biPlot(x, y, separate.axes = TRUE, xPlot = list(name = "observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), yPlot = list(name = "variables", width = "color", size = 0.2, color = "darkblue", symbol = "arrow", filled = FALSE), xPlotLabels = list(labels = "rownames", dir = "NE", size = 8, offset = 0.35), yPlotLabels = list(labels = "colnames", dir = "Auto", size = 8, offset = 0.35, color = "darkblue"), ylabels = 5, xlabels = 5, ylabels2 = 5, xlabels2 = 5, xtitle = "", ytitle = "", xtitle2 = "", ytitle2 = "", range.factor = 1.25, caption = "", margin = c(NA, NA, NA, NA), ...)
x |
a 2-column matrix of x- (column 1) and y- (column 2) coordinates for observations or equivalent. |
y |
a 2-column matrix of x- (column 1) and y- (column 2) coordinates for variables or equivalent. |
separate.axes |
logical, if |
xPlot |
control information to plot the |
yPlot |
control information to plot the |
xPlotLabels |
control information for the |
yPlotLabels |
control information for the |
ylabels |
set y-axis labels for |
xlabels |
set x-axis labels for |
ylabels2 |
set y-axis labels for |
xlabels2 |
set x-axis labels for |
xtitle |
x-axis title (also called x-axis caption) for |
ytitle |
y-axis title (also called y-axis caption) for |
xtitle2 |
x-axis title (also called x-axis caption) for |
ytitle2 |
y-axis title (also called y-axis caption) for |
range.factor |
a numeric factor by which to expand the axis ranges so that labels can be drawn. |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
not used, required for other methods. |
The xPlotLabels
and yPlotLabels
arguments must be tagged lists
with these components:
the labels. For
xPlotLabels
, "rownames" means use the row names from x
to
generate the labels. For yPlotLabels
, "colnames" means use the column
names from y
to generate the labels. Otherwise a character vector of
the labels.
the direction the label text is placed from the object.
the size of the label text.
the distance the labels is placed relative to the object.
the color of the label text.
Information about the graph
A call should be made to setPage
to set up the graphics
environment before calling biPlot
.
Produces a biplot, which is a plot of two different types of data on the same graph, from a principal component analysis.
## S3 method for class 'princomp' biPlot(x, Which = 1:2, Scale = "Auto", obsPlot = list(name = "observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), varPlot = list(name = "variables", width = "color", size = 0.2, color = "darkblue", symbol = "arrow", filled = FALSE), obsPlotLabels = list(labels = "rownames", dir = "NE", size = 8, offset = 0.75), varPlotLabels = list(labels = "colnames", dir = "Auto", size = 8, offset = 0.75, color = "darkblue"), ylabels = 5, xlabels = 5, ylabels2 = "Auto", xlabels2 = "Auto", xtitle = "Auto", ytitle = "Auto", xtitle2 = "Auto", ytitle2 = "Auto", range.factor = 1.25, caption = "", margin = c(NA, NA, NA, NA), ...) ## S3 method for class 'prcomp' biPlot(x, Which = 1:2, Scale = "Auto", obsPlot = list(name = "observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), varPlot = list(name = "variables", width = "color", size = 0.2, color = "darkblue", symbol = "arrow", filled = FALSE), obsPlotLabels = list(labels = "rownames", dir = "NE", size = 8, offset = 0.75), varPlotLabels = list(labels = "colnames", dir = "Auto", size = 8, offset = 0.75, color = "darkblue"), ylabels = 5, xlabels = 5, ylabels2 = "Auto", xlabels2 = "Auto", xtitle = "Auto", ytitle = "Auto", xtitle2 = "Auto", ytitle2 = "Auto", range.factor = 1.25, caption = "", margin = c(NA, NA, NA, NA), ...)
## S3 method for class 'princomp' biPlot(x, Which = 1:2, Scale = "Auto", obsPlot = list(name = "observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), varPlot = list(name = "variables", width = "color", size = 0.2, color = "darkblue", symbol = "arrow", filled = FALSE), obsPlotLabels = list(labels = "rownames", dir = "NE", size = 8, offset = 0.75), varPlotLabels = list(labels = "colnames", dir = "Auto", size = 8, offset = 0.75, color = "darkblue"), ylabels = 5, xlabels = 5, ylabels2 = "Auto", xlabels2 = "Auto", xtitle = "Auto", ytitle = "Auto", xtitle2 = "Auto", ytitle2 = "Auto", range.factor = 1.25, caption = "", margin = c(NA, NA, NA, NA), ...) ## S3 method for class 'prcomp' biPlot(x, Which = 1:2, Scale = "Auto", obsPlot = list(name = "observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), varPlot = list(name = "variables", width = "color", size = 0.2, color = "darkblue", symbol = "arrow", filled = FALSE), obsPlotLabels = list(labels = "rownames", dir = "NE", size = 8, offset = 0.75), varPlotLabels = list(labels = "colnames", dir = "Auto", size = 8, offset = 0.75, color = "darkblue"), ylabels = 5, xlabels = 5, ylabels2 = "Auto", xlabels2 = "Auto", xtitle = "Auto", ytitle = "Auto", xtitle2 = "Auto", ytitle2 = "Auto", range.factor = 1.25, caption = "", margin = c(NA, NA, NA, NA), ...)
x |
an object of class "princomp" that has the information to create a biplot. |
Which |
sequence of two numbers indicating which components to plot. |
Scale |
either a character string indicating the scaling option between observations and variables, or numeric value controling the scaling. If character, then must be one of "auto," "distance," "symmetric," "variance," or "interpolative." See Details. |
obsPlot |
control information to plot the observations. See
|
varPlot |
control information to plot the variables. See
|
obsPlotLabels |
control information for the observation labels. See Details. |
varPlotLabels |
control information for the variable labels. See Details. |
ylabels |
set y-axis labels for the observation data. |
xlabels |
set x-axis labels for the observation data. |
ylabels2 |
set y-axis labels for the variable data. |
xlabels2 |
set x-axis labels for the variable data. |
xtitle |
x-axis title (also called x-axis caption) for the observation data. |
ytitle |
y-axis title (also called y-axis caption) for the observation data. |
xtitle2 |
x-axis title (also called x-axis caption) for the variable data. |
ytitle2 |
y-axis title (also called y-axis caption) for the variable data. |
range.factor |
a numeric factor by which to expand the axis ranges so that labels can be drawn. |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
not used, required for other methods. |
The scaling between observations and variables is controlled by
Scale
, which can take any value between 0 and 1 or a character string
indicating a specific scaling. The options for the character string are:
"distance," which produces a plot where the observations retain their
approximate relation with respect to Eucldiean distances and correponds to a
numeric value of 1; "variance," which produces a plot where the cosine of
the angle between the variable vectors is related to the correlation between
the variables and corresponds to a numeric value of 0; "symmetric," which
tries to balance the range of values for observations and variables to give
a pleasing graph and corresponds to a numeric value of 0.5; or "Auto," which
is the same as "variance." Another option for Scale
is
"interpolative," which produces a specialized axis scaling so that the
approximate values of the variables can be obtained for each observation. It
is not implemented in this version.
The obsPlotLabels
and varPlotLabels
arguments must be tagged
lists with these components:
the labels. For
xPlotLabels
, "rownames" means use the row names from x
to
generate the labels. For yPlotLabels
, "colnames" means use the column
names from y
to generate the labels. Otherwise a character vector of
the labels.
the direction the label text is placed from the object.
the size of the label text.
the distance the labels is placed relative to the object.
the color of the label text.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling biPlot
.
Gower, J.C. and Hand, D.J., 1996, Biplots, Chapman and Hall, London, 277 p.
## Not run: # See for examples of biPlot: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of biPlot: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Produces a truncated, simple, Tukey, or extended box plot.
boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) ## S3 method for class 'numeric' boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) ## S3 method for class 'list' boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) ## S3 method for class 'data.frame' boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA))
boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) ## S3 method for class 'numeric' boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) ## S3 method for class 'list' boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) ## S3 method for class 'data.frame' boxPlot(..., group = NULL, Box = list(type = "truncated", show.counts = TRUE, nobox = 5, width = "Auto", fill = "none", truncated = c(10, 90)), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA))
... |
the data to plot. Missing values are permitted and excluded from the summary statistics computations. |
group |
any vector containing distinct values to create groups of data for
individual box plots. Missing values are not permitted. Valid only when a single
numeric vector is supplied for |
Box |
control parameters for the box. See Details. |
yaxis.log |
logical, if |
yaxis.range |
set y-axis range. See Details. |
ylabels |
set up y-axis labels. See |
xlabels |
set up x-axis labels. Must be either "Auto" or a character vector of the x-axis labels. |
xlabels.rotate |
logical, if |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
If group is numeric, then the boxes will be plotted along a continuous
numeric axis. Otherwise the x-axis will be discrete groups.Box
is
a list with these components:
the type of boxtplot:
"simple" the whiskers extend to the minimum and maximum of the data,
"truncated" the whiskers extend to percentiles defined by truncated
,
"tukey" the standard "Tukey" boxplot as described by Helsel and Hirsch (200),
and "extended" the whisker extend to
percentiles defined by truncated
and values outside of that range are
shown;
show the number of observations used to compute the boxplot statistics;
only individual values are shown if the number of observations is less than or equal to this value;
the width of the box, in inches;
The color of the filled box or "none" for no fill;
the percentiles to use for the truncated boxplot.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choices should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling boxPlot
.
If yaxis.log
is set to
TRUE
, then the quartiles and interquartile range are computed from
the log-transformed values rather then the untransformed values, which is
common for other box plots. Those computations are in agreement with the box
plots generated in the QWGRAPH component of the QWDATA module in the
National Water Information System (NWIS) described by Dennis Helsel's 1989
Branch of Systems Analysis Technical Memorandum No. 89.01, available online
at https://water.usgs.gov/admin/memo/BSA/BSA89.01.pdf. Those
computations have a significant effect on the appearance the whiskers and
outside values of the Tukey box plot and are motivated by the general
assumption of a log-normal distribution for most water-quality constituents.
Helsel, D.R. and Hirsch, R.M., 2002, Statistical methods in water resources: U.S. Geological Survey Techniques of Water-Resources Investigations, book 4, chap. A3, 522 p.
## Not run: set.seed(1) Xbig <- rnorm(100) setGD() # The simple type box plot boxPlot(Xbig, Box=list(type="simple")) # For more details of boxPlot see vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") demo(topic="Coplot-simpleBoxPlot", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) Xbig <- rnorm(100) setGD() # The simple type box plot boxPlot(Xbig, Box=list(type="simple")) # For more details of boxPlot see vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") demo(topic="Coplot-simpleBoxPlot", package="smwrGraphs") ## End(Not run)
Computes the statistics for truncated, simple, Tukey, or extended box plots
(support function for boxPlot
).
boxPlotStats(x, Box, yaxis.log)
boxPlotStats(x, Box, yaxis.log)
x |
a list containing the data to compute the statistics. |
Box |
control parameters for the box as set by the user and verified by
|
yaxis.log |
logical, if |
a list containing the statistics for each box plot.
Produces a line/scatter plot where each point or group of related points has a unique color or where sections along a line have different colors.
colorPlot(x, y, color, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric,numeric' colorPlot(x, y, color, Plot = list(name = "Auto", what = "points", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto", groups = 4, ramp = "greenRed"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'Date,numeric' colorPlot(x, y, color, Plot = list(name = "Auto", what = "lines", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto", groups = 10, ramp = "greenRed"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'POSIXt,numeric' colorPlot(x, y, color, Plot = list(name = "Auto", what = "lines", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto", groups = 10, ramp = "greenRed"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
colorPlot(x, y, color, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric,numeric' colorPlot(x, y, color, Plot = list(name = "Auto", what = "points", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto", groups = 4, ramp = "greenRed"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'Date,numeric' colorPlot(x, y, color, Plot = list(name = "Auto", what = "lines", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto", groups = 10, ramp = "greenRed"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'POSIXt,numeric' colorPlot(x, y, color, Plot = list(name = "Auto", what = "lines", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto", groups = 10, ramp = "greenRed"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
x |
the x-axis data |
y |
the y-axis data |
color |
the colors or a class to set colors, must match the length of
|
Plot |
tagged list of control parameters of the plot: |
yaxis.log |
logical, if |
yaxis.rev |
logical, if |
yaxis.range |
set the range of the y-axis. See Details. |
xaxis.log |
logical, if |
xaxis.range |
set the range of the x-axis. See Details. |
ylabels |
set up y-axis labels. |
xlabels |
set up x-axis labels. |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
arguments for specific methods. |
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
Typically used to create a colored scatter plot for numeric x and y data.
Can be used to create a hydrograph where the line is colored by a third variable, or a colored scatter plot over time.
Can be used to create a hydrograph where the line is colored by a third variable, or a colored scatter plot over time.
A call should be made to setPage
to set up the graphics
environment before calling colorPlot
.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) Z <- sqrt(X^2 + Y^2) # distance from origin setGD() # All defaults: color ramp from Z colorPlot(X, Y, Z) # See for examples of colorPlot: vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) Z <- sqrt(X^2 + Y^2) # distance from origin setGD() # All defaults: color ramp from Z colorPlot(X, Y, Z) # See for examples of colorPlot: vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Facilitates producing a series of graphs conditioned by a grouping variable.
condition(plot.call, data, group, format = "grid", num.cols = NA, num.rows = NA, explanation = NULL, share = "", group.name = "", xtitle = "", ytitle = "", caption = "")
condition(plot.call, data, group, format = "grid", num.cols = NA, num.rows = NA, explanation = NULL, share = "", group.name = "", xtitle = "", ytitle = "", caption = "")
plot.call |
either a simple call to a graphics function or a sequence of calls enclosed in curly braces({}) |
data |
the data.frame containing the variables used in |
group |
a character string identifying the grouping variable in
|
format |
the orientation of the graphs. If "table," then the graphs are created beginning in the upper-left hand corner. If "grid," then the graphs are created beginning in the lower-left See Details. hand corner. |
num.cols |
the number of columns on each page. See Details. |
num.rows |
the number of rows on each page. See Details. |
explanation |
where to place an explanation if necessary. See
|
share |
character, if |
group.name |
a character string to prepend to each value in
|
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
Graphs are created by executing plot.call
for each unique value in
the variable specified by group
. The columns and rows are set by
num.cols
and num.rows
. If both are set to missing NA
,
then each page contains 1 graph, and the graphics setup should provide for
mulitple pages. If one of num.cols
or num.rows
is set to a
numeric value, the other is calculated from the number of graphs so that all
graphs would be displayed on a single page. If both num.cols
and
num.rows
are set to numeric values, then each page would contain a
maximum of num.cols
times num.rows
and multiple pages would be
needed if that were less than the total number of graphs.
The order of the graphs is controlled by the type of group
. If
group
is a factor, then the order is set by the order of the levels,
otherwise the order is set by the order from unique
.
The value returned by plot.call
is returned invisibly. If
used correctly, it could be used to add an explanation.
This function is designed to facilitate the production of conditioned
graphs, but may not render each collection completely. For example, graphs
arranged in table format will not have x-axis labels for incomplete
columns.
A call must be made to setPage
or setPDF
to set up the
graphics page before calling condition
. The returned value can be
used to create an explanation, if desired. If explanation
is not
NULL
, then the graph is set to the explanation and there is no need
to call setGraph
to set up the explanation.
The called plotting function must set the margin
argument to
.margin
. See the demos for examples.
Cleveland, W.S., 1993, Visualizing data: Summit, New Jersey, Hobart Press, 360 p.
setLayout
, setPage
,
setPDF
, unique
## Not run: # See for examples of condition: demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="Coplot-simpleBoxPlot", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of condition: demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="Coplot-simpleBoxPlot", package="smwrGraphs") ## End(Not run)
Produces a contour plot or a colored surface with colors corresponding to
values in z
.
contourPlot(z, ...) ## Default S3 method: contourPlot(z, x, y, Grid = list(method = "interpolate", linear = TRUE, extrapolate = FALSE, density = 90, span = 0.75, degree = 1, family = "symmetric"), Contours = list(name = "Auto", levels = 10, filled = FALSE, lineColor = "black", lineLabel = "flattest", fillColors = "coolWarm"), yaxis.range = c(NA, NA), xaxis.range = c(NA, NA), ylabels = 4, xlabels = 4, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S3 method for class 'matrix' contourPlot(z, rows, cols, matrix.rows = "x", Contours = list(name = "Auto", levels = 10, filled = FALSE, lineColor = "black", lineLabel = "flattest", fillColors = "coolWarm"), yaxis.range = c(NA, NA), xaxis.range = c(NA, NA), ylabels = 4, xlabels = 4, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
contourPlot(z, ...) ## Default S3 method: contourPlot(z, x, y, Grid = list(method = "interpolate", linear = TRUE, extrapolate = FALSE, density = 90, span = 0.75, degree = 1, family = "symmetric"), Contours = list(name = "Auto", levels = 10, filled = FALSE, lineColor = "black", lineLabel = "flattest", fillColors = "coolWarm"), yaxis.range = c(NA, NA), xaxis.range = c(NA, NA), ylabels = 4, xlabels = 4, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S3 method for class 'matrix' contourPlot(z, rows, cols, matrix.rows = "x", Contours = list(name = "Auto", levels = 10, filled = FALSE, lineColor = "black", lineLabel = "flattest", fillColors = "coolWarm"), yaxis.range = c(NA, NA), xaxis.range = c(NA, NA), ylabels = 4, xlabels = 4, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
z |
the values representing the surface data. |
... |
not used, required for other methods. |
x |
the x-axis coordinates for each value in |
y |
the y-axis coordinates for each value in |
Grid |
control parameters for gridding irregularly spaced data. See Details. |
Contours |
control parameters for the coutour lines or levels in the filled plot. See Details. |
yaxis.range |
set the range of the y-axis. |
xaxis.range |
set the range of the x-axis. |
ylabels |
set up y-axis labels. See |
xlabels |
set up x-axis labels. See |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
rows |
the coordinates for |
cols |
the coordinates for |
matrix.rows |
a single character, either "x" or "y" indicating whether the rows in z should be plotted along the x or y axis. |
Missing values are permitted in z
, x
, and y
for the default
method and are removed, with a warning. before constructing the surface. Duplicated values,
identical x
and y
, are not permitted and generate an error.
Missing values are not permitted in rows
or columns
but are permitted
in z
for the matrix method. Missing values in z
result in blank areas
in the plot.
The Grid
argument must be a tagged list with these components:
The method to use for constructung the grid. Must be either "interpolate"
or "loess." If "interpolate," then the z
values are interpolated directly from the
x
and y
values. If "loess," then the z
values are smoothed prior to
interpolation
Logical, if TRUE
, then use linear interpolation, if FALSE
, then
use spline interpolation.
Logical, if TRUE
, then extrapolate to the limits of the grid, if
FALSE
, then do not extrapoalte outsite of the hull of the data values.
The density of the grid—the number of cells along x
and y
.
The span
argument for loess
if method
is "loess."
The degree
argument for loess
if method
is "loess."
The family
argument for loess
if method
is "loess."
#'The Contour
argument must be a tagged list with these components:
The name to use to describe the contours. If "Auto" and filled
is
TRUE
, then the descripotion is blank. If "Auto" and filled
is FALSE
,
the the description is Line of equal value." In all other cases, the description is the
text assigned to name
.
Either the number of levels of contours or a vector of the desired contour levels.
Logical, if TRUE
, then draw filled contours, if FALSE
, then
only contour lines are drawn.
The color to draw the contour lines. Can be set to "none" to supress drawing lines for filled contours.
A character string indicating how to draw the labels on the contours. May be
"none" to supress draing the labels, or any valid value for the method
argument
to contour
.
The prefix corresponding to a color ramp generating function, like "warmCool"
for the warmCool.colors
function.
Information about the graph.
## Not run: set.seed(1) Xbig <- runif(100) Ybig <- runif(100) # Make a hill Zbig <- 1 - ((Xbig-.5)^2 + (Ybig-.5)^2)^.75 setGD() contourPlot(Zbig, Xbig, Ybig) # See for examples of contourPlot see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) Xbig <- runif(100) Ybig <- runif(100) # Make a hill Zbig <- 1 - ((Xbig-.5)^2 + (Ybig-.5)^2)^.75 setGD() contourPlot(Zbig, Xbig, Ybig) # See for examples of contourPlot see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Copies a demo file from the source package to a file.
copyDemo(topic, package = "smwrGraphs", file)
copyDemo(topic, package = "smwrGraphs", file)
topic |
the name of the topic, must be a character string. |
package |
the package name, must be a character string. |
file |
the target file name, must be a character string. If missing,
then the file name is created from the |
Either the name of the target file or NULL
if the copy
failed.
## Not run: copyDemo("HydroPrecip")
## Not run: copyDemo("HydroPrecip")
Creates a correlogram for irregularly spaced data.
corGram(x, y, Plot = list(name = "Standardized Observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.03, color = "gray40"), CorGram = list(band = 0.15, kernel = "normal", color = "black", width = "standard", add0line = TRUE), yaxis.range = c(-3, 3), xaxis.range = c(0, 1.5), ylabels = 7, xlabels = 4, xtitle = "Difference in Time, in Years", ytitle = "Standardized Serial Correlation", caption = "", margin = c(NA, NA, NA, NA))
corGram(x, y, Plot = list(name = "Standardized Observations", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.03, color = "gray40"), CorGram = list(band = 0.15, kernel = "normal", color = "black", width = "standard", add0line = TRUE), yaxis.range = c(-3, 3), xaxis.range = c(0, 1.5), ylabels = 7, xlabels = 4, xtitle = "Difference in Time, in Years", ytitle = "Standardized Serial Correlation", caption = "", margin = c(NA, NA, NA, NA))
x |
decimal time. |
y |
residuals or other observations, these will be scaled, but not centered. |
Plot |
parameters defining the characteristics of the plot. See
|
CorGram |
control parameters of the correlogram line. See Details. |
yaxis.range |
set the y-axis range. |
xaxis.range |
set the x-axis range. |
ylabels |
set the y-axis labels. See |
xlabels |
set the x-axis labels. See |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
CorGram
is a list with these components:
a measure of the bandwidth used by locpoly
the kernel used, currently ignored
the color of the line representing the correlogram
the line width of the line representing the correlogram
logical, if TRUE
, then add the 0 line; if FALSE
,
then do not draw the 0 line
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling corGram
.
## Not run: # See for examples of corGram: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of corGram: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Constructs an ellipse from a covariance matrix.
cov2Ellipse(cov, center, scale = 1, n = 151)
cov2Ellipse(cov, center, scale = 1, n = 151)
cov |
the 2-dimenstional covariance matrix, representing x and y. |
center |
the means of x and y. |
scale |
the size of the ellipse in units of standard deviation. |
n |
the number of points in the returned data. |
A list containing the x- and y-coordinates of the ellipse.
# make a few points on a unit circle TMP <- cov2Ellipse(matrix(c(1,0,0,1), ncol=2), c(0,0), n=5) # Pretty print the data lapply(TMP, zapsmall)
# make a few points on a unit circle TMP <- cov2Ellipse(matrix(c(1,0,0,1), ncol=2), c(0,0), n=5) # Pretty print the data lapply(TMP, zapsmall)
Constructs an ellipse from x- and y-coordinate data.
dataEllipse(x, y, percent = 100, smooth = 0)
dataEllipse(x, y, percent = 100, smooth = 0)
x |
the x-coordinate data. |
y |
the y-coordinate data. |
percent |
a scale factor, adjusted to include |
smooth |
required for naming compatibility with other functions, not used. |
A list containing the x- and y-coordinates of the ellipse.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) TMP <- dataEllipse(X, Y) # Just print the first 10 values lapply(TMP, function(x) x[1:10]) # For examples of dataEllipse in graphs see: vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) TMP <- dataEllipse(X, Y) # Just print the first 10 values lapply(TMP, function(x) x[1:10]) # For examples of dataEllipse in graphs see: vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Constructs information for making a nicely formatted date axis. A support function for creating date/time axes. Understanding the arguments can help in building specially formatted axes.
datePretty(x, major = "Auto", minor = "Auto", tick.span = 1, style = c("Auto", "at", "between"), label.abbr = 0)
datePretty(x, major = "Auto", minor = "Auto", tick.span = 1, style = c("Auto", "at", "between"), label.abbr = 0)
x |
date and time data |
|||||||||
major |
the major tick interval, must be one of "hours," "days," "months,"
"years," "water years," or "Auto," which will make an intelligent choice
from those. "Auto" will also automatically change |
|||||||||
minor |
the minor tick interval, must be one of "min," "hours," "days,"
"months," "years," or "Auto," which will make an intelligent choice from
those, possibly adjusted by a scaling factor. Can also be formatted as an
argument to |
|||||||||
tick.span |
span between major labels. For example, with "years" option, tick.span=5 would generate labels like 1990, 1995, 2000 and so forth. |
|||||||||
style |
the style of labels, must be one of "at," "between," or "Auto," which selects the "best" style. "At" places the labels at the ticks and "between" places the labels between the major ticks. Abbreviations are permitted. |
|||||||||
label.abbr |
indicator of the degree of abbreviation for labels
|
Setting major
to "water year" is practical only for periods of
time from 1 to 5 water years in length; also sets the date range to water years.
Formatting information about the axis labels.
timePlot
, month.USGS
, timePretty
Produces a tree graph from a hierarchical cluster analysis.
dendGram(x, Tree = list(orientation = "vertical", width = "standard", color = "black"), axis.range = c(NA, NA), labels = "Auto", ytitle = "", xtitle = "", caption = "", margin = c(NA, NA, NA, NA))
dendGram(x, Tree = list(orientation = "vertical", width = "standard", color = "black"), axis.range = c(NA, NA), labels = "Auto", ytitle = "", xtitle = "", caption = "", margin = c(NA, NA, NA, NA))
x |
the data to plot. Must be able to be converted to class "dendrogram." |
Tree |
control parameters of the tree diagram. See Details. |
axis.range |
set the range of the tree-axis. |
labels |
set the tree-axis labels. See |
ytitle |
the y-axis title (also called y-axis caption). |
xtitle |
the x-axis title (also called x-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
Tree
is a list with these components:
the orientation of the dendrogram, must be either "vertical" or "horizontal"
the line width of the line representing the dendrogram
the color of the line representing the dendrogram
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling ecdfPlot
.
## Not run: # For an example of a dendGram see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: # For an example of a dendGram see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Creates a dot plot.
dotPlot(x, y, Plot = list(), yaxis.orient = "", yaxis.order = "", yaxis.grid = TRUE, xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = "", xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric' dotPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.orient = "table", yaxis.order = "none", yaxis.grid = TRUE, xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = "full", xlabels = 7, xtitle = deparse(substitute(x)), ytitle = "", caption = "", margin = c(NA, NA, NA, NA), jitter.y = TRUE, ...) ## S4 method for signature 'Date' dotPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.orient = "table", yaxis.order = "none", yaxis.grid = TRUE, xaxis.log = FALSE, xaxis.range = range(x, na.rm = TRUE), ylabels = "full", xlabels = "Auto", xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), jitter.y = TRUE, ...)
dotPlot(x, y, Plot = list(), yaxis.orient = "", yaxis.order = "", yaxis.grid = TRUE, xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = "", xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric' dotPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.orient = "table", yaxis.order = "none", yaxis.grid = TRUE, xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = "full", xlabels = 7, xtitle = deparse(substitute(x)), ytitle = "", caption = "", margin = c(NA, NA, NA, NA), jitter.y = TRUE, ...) ## S4 method for signature 'Date' dotPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.orient = "table", yaxis.order = "none", yaxis.grid = TRUE, xaxis.log = FALSE, xaxis.range = range(x, na.rm = TRUE), ylabels = "full", xlabels = "Auto", xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), jitter.y = TRUE, ...)
x |
the x-axis data. Missing values are permitted and not plotted. |
y |
the y-axis data, expected to be be either character or factor. Missing values are permitted and removed before plotting. |
Plot |
control parameters of the plot, see |
yaxis.orient |
orientation of the y-axis values, must be either "table" or "grid." "Table" is sorted from top to bottom, "grid" is sorted from bottom to top. |
yaxis.order |
the order of the y-axis values, must be one of "none," "ascending," or "descending." |
yaxis.grid |
logical, if |
xaxis.log |
logical, if |
xaxis.range |
set the range of the x-axis. See Details. |
ylabels |
set up y-axis labels. |
xlabels |
set up x-axis labels. |
xtitle |
x-axis title (also called x-axis caption). |
ytitle |
y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
arguments for specific methods. |
jitter.y |
logical, if |
The what
component of the Plot
argument must be either
"points" or "none."
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
Create a dot plot for numeric x-coordinate data and any (discrete) y-coordinate data.
Create a dot plot for Date x-coordinate data and any (discrete) y-coordinate data.
A call should be made to setPage
to set up the graphics
environment before calling dotPlot
.
## Not run: set.seed(1) X <- runif(12) Y <- LETTERS[1:12] setGD() dotPlot(X, Y) # For more details of dotPlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- runif(12) Y <- LETTERS[1:12] setGD() dotPlot(X, Y) # For more details of dotPlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Creates a graph of the empirical distribution function of data.
ecdfPlot(x, group = NULL, Plot = list(name = "Auto", what = "stairstep", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto"), xaxis.log = TRUE, xaxis.range = c(NA, NA), xlabels = 11, ylabels = 5, ytitle = "Cumulative Probability", xtitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: ecdfPlot(x, group = NULL, Plot = list(name = "Auto", what = "stairstep", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto"), xaxis.log = TRUE, xaxis.range = c(NA, NA), xlabels = 11, ylabels = 5, ytitle = "Cumulative Probability", xtitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...)
ecdfPlot(x, group = NULL, Plot = list(name = "Auto", what = "stairstep", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto"), xaxis.log = TRUE, xaxis.range = c(NA, NA), xlabels = 11, ylabels = 5, ytitle = "Cumulative Probability", xtitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: ecdfPlot(x, group = NULL, Plot = list(name = "Auto", what = "stairstep", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "Auto"), xaxis.log = TRUE, xaxis.range = c(NA, NA), xlabels = 11, ylabels = 5, ytitle = "Cumulative Probability", xtitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...)
x |
the data to plot. |
group |
create groups for |
Plot |
parameters defining the characteristics of the plot. See
|
xaxis.log |
logical, if |
xaxis.range |
set the range of the x-axis. See Details. |
xlabels |
set the x-axis labels. See |
ylabels |
set the y-axis labels. See |
ytitle |
the y-axis title (also called y-axis caption). |
xtitle |
the x-axis title (also called x-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
any additional arguments needed by specific methods. |
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling ecdfPlot
.
## Not run: set.seed(1) X <- rlnorm(32) setGD() ecdfPlot(X) # For more details of ecdfPlot see vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rlnorm(32) setGD() ecdfPlot(X) # For more details of ecdfPlot see vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
Gets the density, cumulative distribution, quantile, or
random generation of the specified distribution. This function is used primarily
as a support function for probPlot
.
getDist.fcn(distribution, what = "q")
getDist.fcn(distribution, what = "q")
distribution |
the name of the distribution. See Details. |
what |
a character indicating which form to retrun. Must be "q" for quantile, "d" for density, "p" for cumulative distribution, or "r" for random generation. |
For general use, distribution
should be one of "normal," "lognormal,"
"pearsonType3," "logpearsonType3," "exponential," "logistic," or "uniform."
Partial matching is done, so only as many characters to make a unique match
are required. Other distributions can be retrieved by specifying the base
name of the distribution. That option can be useful if other packages that
contain distribution functions have been loaded.
The specified function.
Normal
, Lognormal
,
Exponential
, Logistic
,
Uniform
,
PearsonIII
, LogPearsonIII
,
Creates either a frequency or density histogram.
histGram(x, breaks = "Sturges", Hist = list(), yaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = "Auto", caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: histGram(x, breaks = "Sturges", Hist = list(type = "frequency", fill = FALSE, boundary = "lower", line.color = "black", fill.color = "gray80"), yaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = "Auto", caption = "", margin = c(NA, NA, NA, NA), ...)
histGram(x, breaks = "Sturges", Hist = list(), yaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = "Auto", caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: histGram(x, breaks = "Sturges", Hist = list(type = "frequency", fill = FALSE, boundary = "lower", line.color = "black", fill.color = "gray80"), yaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = "Auto", caption = "", margin = c(NA, NA, NA, NA), ...)
x |
a numeric vector to create the histogram |
breaks |
any valid value for |
Hist |
control parameters of the histogram. See Details. |
yaxis.range |
set the range for the y axis, the first value must be 0. |
ylabels |
the approximate number of labels for the y axis. |
xlabels |
the approximate number of labels for the x axis. The default value, "Auto" sets labels that are aligned with the breaks. |
xtitle |
x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption), "Frequency" for a frequency histogram, "Density" for a density histogram. |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
additional arguments for other methods. |
To set the x-axis range, you must specify numeric breaks that span the
complete range of x
.
The components of Hist
:
The type of the histogram. Must be one of "frequency" for actual counts in the bin, "density" for density in each bin, or "relative frequency" for percent in each bin.
Logical value, TRUE
means each bin will be shaded with fill.color
.
Defines how values tied to bin limit boundaires are handled. If "upper," then the bin limit boundary is the upper limit of the range and values tied to that value are placed in the bin corresponding to the upper limit of the boundary. If "lower," then the bijn limit is the lower limit of the bin.
The color of the lines around the bins.
The color the bins.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling histGram
.
#'Helsel, D.R., and Hirsch, R.M., 2002, Statistical methods in water resources: U.S. Geological Survey Techniques of Water-Resources Investigations, book 4, chap. A3, 522 p.
## Not run: set.seed(1) Xbig <- rnorm(100) setGD() histGram(Xbig, breaks=seq(-3, 3, by=.5), Hist=list(type="density")) # For more details of histGram see vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) Xbig <- rnorm(100) setGD() histGram(Xbig, breaks=seq(-3, 3, by=.5), Hist=list(type="density")) # For more details of histGram see vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
Constructs an enclosing hull from x- and y-coordinate data.
hull(x, y, percent = 100, smooth = FALSE)
hull(x, y, percent = 100, smooth = FALSE)
x |
the x-coordinate data. Missing values are permitted, but ignored. |
y |
the y-coordinate data. Missing values are permitted, but ignored. |
percent |
the minimum percent to enclose. |
smooth |
logical, if |
A list containing the x- and y-coordinates of the hull.
set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) # The enclosing polygon hull(X, Y) # The points chull(X, Y) ## Not run: # For examples of hull in graphs see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) # The enclosing polygon hull(X, Y) # The points chull(X, Y) ## Not run: # For examples of hull in graphs see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Creates a vector of interpolated points along a line drawn by one of the
smwrGraphs
functions.
interpLine(object, xfromy, yfromx, warn = TRUE, ...)
interpLine(object, xfromy, yfromx, warn = TRUE, ...)
object |
an object created by one of the |
xfromy |
the y-axis coordinate values to use to create matching x-coordinate values. Missing values are permitted but result in missing values in the output. |
yfromx |
the x-axis coordinate values to use to create matching y-coordinate values. Missing values are permitted but result in missing values in the output. |
warn |
logical, if |
... |
any future additional arguments. |
Exactly one of xfromy
or yfromx
must be specified in the call.
A vector of numeric values corresponding to those values in either
xfromy
or yfromx
.
The back-transformation information is not included in the output from
the graphics functions. This primarily affects the transPlot
function.
## Not run: # See for examples of interpLine: demo(topic="FlowDur-Measurements", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of interpLine: demo(topic="FlowDur-Measurements", package="smwrGraphs") ## End(Not run)
Labels points on a graph.
labelPoints(x, y, labels, dir = "E", offset = 0.75, size = 8, color = "black", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
labelPoints(x, y, labels, dir = "E", offset = 0.75, size = 8, color = "black", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
x |
the x-axis data. Missing values are permitted, but ignored. |
y |
the y-axis data. Missing values are permitted, but ignored. |
labels |
the text labels, must be the same length as x and y. Missing values are permitted, but ignored. |
dir |
the direction relative to the point to place the label. See Details. |
offset |
the relative offset from the point. See Details. |
size |
character size in points. |
color |
the color of the labels. |
current |
the current plot controls. Typically, this would be the
output from one of the graph creation functions like |
The value for dir
can be of length one or the length of x
,
in which case, dir
applies to the corresponding point. The value must be
"N," "NE," "E," "SE," "S," "SW," "W," or "NW" cooresponding to the compass
direction or "C" to center the label.
The value for offset
can be of length one or the length of x
, in
in which case, offset
applies to the corresponding point. The value is relative
to the size of the test. The default value of offset
is correct for creating a
text plot, where the text is centered on the value.
A list containing x
, y
, and labels
.
The current version does not have any method to automatically eliminate
overlapping labels. Several iterations may be required trying various values for
dir
and possibly offset
to produce non overlapping labels.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() xyPlot(X, Y) # Label the first point labelPoints(X[1], Y[1], "First") # For more details of labelPoints see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() xyPlot(X, Y) # Label the first point labelPoints(X[1], Y[1], "First") # For more details of labelPoints see vignette(topic="GraphAdditions", package="smwrGraphs") ## End(Not run)
Constructs information for making a nicely formatted linear numeric axis. A support function for creating linear axes.
linearPretty(x, hard = FALSE, labels = "Auto", style = "Auto", extend.pct = 0, extend.range = TRUE)
linearPretty(x, hard = FALSE, labels = "Auto", style = "Auto", extend.pct = 0, extend.range = TRUE)
x |
data defining the range to be plotted on the axis. Missing values are permitted, but ignored. |
hard |
logical, if |
labels |
either "Auto," which lets the function decide how many labels,
the approximate number of labels, or the actual labels to use. If the actual
labels are numeric, then the will be formatted using |
style |
a character string indicating the style of the axis labels if
they are not specifically listed in |
extend.pct |
extend the axis range by |
extend.range |
if |
Information about the axis labels.
areaPlot
, boxPlot
,
colorPlot
, areaPlot
, dotPlot
,
ecdfPlot
, probPlot
, qqPlot
,
scalePlot
, splomPlot
, timePlot
,
xyPlot
Computes the weight, or width, of a line. Used primarily as a support function.
lineWt(x) frameWt() stdWt(x = 1)
lineWt(x) frameWt() stdWt(x = 1)
x |
for |
The width of the line to set as the lwd
graphics parameter.
Constructs information for making a nicely formatted log-scale numeric axis. A support function for creating logarithmic axes.
logPretty(x, hard = FALSE, labels = "Auto", style = "Auto", extend.pct = 0, extend.range = NA)
logPretty(x, hard = FALSE, labels = "Auto", style = "Auto", extend.pct = 0, extend.range = NA)
x |
data defining the range to be plotted on the axis. Missing values are permitted, but ignored. |
hard |
logical, if |
labels |
either "Auto," which lets the function decide how many labels, the approximate number of labels, or the actual numeric values of the labels. |
style |
a character string indicating the style of the axis labels. Valid values are "numeric," which forces the labels to be displayed as numbers; "scientific," which forces the labels displayed using scientific notation; or "Auto" (the default), which disaplays labels as numbers but switches to scientific notation for large ranges. Only the first letter is required. Any invalid value will produce simply formatted labels. |
extend.pct |
extend the axis range by |
extend.range |
required for naming consistency with other functions, not used. |
Information about the axis lables.
areaPlot
, boxPlot
,
colorPlot
, areaPlot
, dotPlot
,
ecdfPlot
, probPlot
, qqPlot
,
scalePlot
, splomPlot
, timePlot
,
xyPlot
A vector of USGS-style month abbreviations.
month.USGS
month.USGS
A named character vector of the 12 preferred forms for month abbreviations.
Hansen, W.R., 1991, Suggestions to Authors of the United States Geological Survey, 7th Ed.: U.S. Govenement Printing Office, 289 p.
print(month.USGS) ## Not run: # For examples of month.USGS in graphs see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
print(month.USGS) ## Not run: # For examples of month.USGS in graphs see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Constructs information for making a nicely formatted axis for discrete data. A support function for creating discrete axes.
namePretty(x, orientation = "table", order = "none", label.abbr = FALSE, offset = 0.5, style = "at")
namePretty(x, orientation = "table", order = "none", label.abbr = FALSE, offset = 0.5, style = "at")
x |
the discrete data values. |
|||||||||||
orientation |
the orientation of the data in
|
|||||||||||
order |
the order of the data in
|
|||||||||||
label.abbr |
logical, if |
|||||||||||
offset |
amount to offset the range, generally 0.5 or 1. The range of
the data is from 1 to the number of elements in |
|||||||||||
style |
character string indicating the placement of the ticks. If "at" (default), then place ticks at the labels. If "between," then place ticks between the labels. |
Information about the axis labels
Converts data to numeric values (support function).
numericData(x, lev = NULL)
numericData(x, lev = NULL)
x |
any vector that can be converted to numeric. |
lev |
levels for character data that represent categories rather than character representations of numeric values. |
Numeric data represented by x
.
Constructs a parametric interpolating spline for x and y data. The x data are not required to be strictly increasing. Used as a support function.
paraSpline(x, y, n)
paraSpline(x, y, n)
x |
the x-coordinate data. Missing values are not permitted. |
y |
the y-coordinate data. Missing values are not permitted. |
n |
The number of points in the output parametric spline fit. |
A list containing the components x
and y
, which are
the coordinates of the parametric spline.
paraSpline(c(1,2,3), c(0,1,0), n=5)
paraSpline(c(1,2,3), c(0,1,0), n=5)
Produces a Piper diagram.
piperPlot(xCat, yCat, zCat, xAn, yAn, zAn, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), axis.range = c(0, 100), num.labels = 6, ticks = FALSE, grids = !ticks, xCat.title = "Calcium", yCat.title = "Magnesium", zCat.title = "Sodium plus Potassium", xAn.title = "Chloride, Fluoride, Nitrite plus Nitrate", yAn.title = "Carbonate plus Bicarbonate", zAn.title = "Sulfate", x.yCat.title = "Calcium plus Magnesium", x.zAn.title = "Sulfate plus Chloride", units.title = "Percent", caption = "", margin = c(NA, NA, NA, NA))
piperPlot(xCat, yCat, zCat, xAn, yAn, zAn, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), axis.range = c(0, 100), num.labels = 6, ticks = FALSE, grids = !ticks, xCat.title = "Calcium", yCat.title = "Magnesium", zCat.title = "Sodium plus Potassium", xAn.title = "Chloride, Fluoride, Nitrite plus Nitrate", yAn.title = "Carbonate plus Bicarbonate", zAn.title = "Sulfate", x.yCat.title = "Calcium plus Magnesium", x.zAn.title = "Sulfate plus Chloride", units.title = "Percent", caption = "", margin = c(NA, NA, NA, NA))
xCat |
data for the cation x-axis, generally calcium. |
yCat |
data for the cation y-axis, generally magnesium. |
zCat |
data for the cation z-axis, generally sodium plus potasium. |
xAn |
data for the anion x-axis, generally chloride plus other minor constituents. |
yAn |
data for the anion y-axis, generally carbonate plus bicarbonate. |
zAn |
data for the anion z-axis, generally sulfate. |
Plot |
control parameters of the plot, see |
axis.range |
the range of the axes. Must be either c(0, 1) or c(0, 100). |
num.labels |
the number of labels to draw on each axis. Best selections are 2 giving (0, 100), 3 (0, 50, 100), 5 (0, 25, 50, 75, 100), or 6 (o, 20, 40, 60, 80, 100). |
ticks |
logical, if |
grids |
logical, if |
xCat.title |
title (also called caption) for the cation x-axis. |
yCat.title |
title (also called caption) for the cation y-axis. |
zCat.title |
title (also called caption) for the cation x-axis. |
xAn.title |
title (also called caption) for the anion x-axis. |
yAn.title |
title (also called caption) for the anion y-axis. |
zAn.title |
title (also called caption) for the anion z-axis. |
x.yCat.title |
title for the cation x- and y-axis for the central Piper graph. |
x.zAn.title |
title for the anion x- and z-axis for the central Piper graph. |
units.title |
the units titles, should be either "Percent" of
"Proportion" depending on |
caption |
the figure caption. |
margin |
set up the plot area margins—ignored, included for consistency with other plotting functions in this package. |
The what
component of the Plot
argument must be either
"points" or "none."
The units for xCat
, yCat
, zCat
, xAn
,
yAn
, and zAn
should be in milli-equivalents.
Information about the graph and current plot.
A call should be made to setPage
to set up the graphics
environment before calling piperPlot
.
Hem J.D., 1989, Study and interpretation of the chemical characteristics of natural water: U.S. Geological Survey Water-Supply Paper 2254, 263 p.
setPage
, setMultiPlot
,
ternaryPlot
, addPiper
## Not run: # See for examples of piperPlot: vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of piperPlot: vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
Plots the Piper diagram projected from the two trilinear diagrams on either side (support function).
piperSubplot(x, y, what = "points", symbol = rep(1, length(x)), color = rep(1, length(x)), size = rep(0.05, length(x)), axis.range = c(0, 100), num.labels = 6, ticks = FALSE, grids = !ticks, x1title = "x1", y1title = "y1", x2title = "x2", y2title = "y2", plot = TRUE)
piperSubplot(x, y, what = "points", symbol = rep(1, length(x)), color = rep(1, length(x)), size = rep(0.05, length(x)), axis.range = c(0, 100), num.labels = 6, ticks = FALSE, grids = !ticks, x1title = "x1", y1title = "y1", x2title = "x2", y2title = "y2", plot = TRUE)
x |
x-axis coordinate values (derived from the cation z-axis). |
y |
y-axis coordinate values (derived from the anion y-axis). |
what |
the type of plot, must be either "points" or "lines." |
symbol |
the symbol to use if |
color |
the color of the plot. |
size |
the size of the symbol if |
axis.range |
the range of the axes. Must be either c(0, 1) or c(0, 100). |
num.labels |
the number of labels to draw on each axis. |
ticks |
logical, if |
grids |
logical, if |
x1title |
the title (also called caption) of the bottom x-axis. |
y1title |
the title (also called caption) of the left y-axis. |
x2title |
the title (also called caption) of the top x-axis. |
y2title |
the title (also called caption) of the right y-axis. |
plot |
logical, if |
Support function, to be called only from piperPlot
.
If plot
is TRUE, then the range of the user coordinates.
Otherwise, the transformed x- and y-coordinate values.
Selects the projection for a surface plot.
preSurface(x, y, z.surf, zaxis.log = FALSE, zaxis.range = c(NA, NA), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), xlabels = "Auto", ylabels = "Auto", zlabels = "Auto", phi = NA, theta = NA, batch = FALSE)
preSurface(x, y, z.surf, zaxis.log = FALSE, zaxis.range = c(NA, NA), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), xlabels = "Auto", ylabels = "Auto", zlabels = "Auto", phi = NA, theta = NA, batch = FALSE)
x |
the x-axis coordinate data, must be strictyly increasing. Missing values not permitted. May be of type Date. |
y |
the y-axis coordinate data, must be strictyly increasing. Missing values not permitted. |
z.surf |
a numeric matrix representing the surface. The length of |
zaxis.log |
logical, if |
zaxis.range |
set the range of the z-axis. |
yaxis.log |
logical, if |
yaxis.range |
set the range of the y-axis. |
xaxis.log |
logical, if |
xaxis.range |
set the range of the x-axis. |
xlabels |
set up x-axis labels. |
ylabels |
set up y-axis labels. |
zlabels |
set up z-axis labels. |
phi |
the viewing angle relative to the x-y plane. If |
theta |
the viewing angle relative to the x-axis. Positive values rotate
the x-y plane in a clock-wise direction. If |
batch |
logical or character. If logical and |
A list containg the projection information and the data for plotting. Must
be used in the call to surfacePlot
## Not run: # See for examples of preSurface: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of preSurface: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Prints the layout of a figure.
## S3 method for class 'Layout' print(x, ...)
## S3 method for class 'Layout' print(x, ...)
x |
the object to print |
... |
not used, required for other methods |
The object x
is returned invisibly.
The layout of graphs is displayed.
Creates a probability plot.
probPlot(x, truncate = NA, FLIP = FALSE, distribution = "normal", alpha = 0.4, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = TRUE, yaxis.range = c(NA, NA), ylabels = 11, xlabels = 11, CDF = !RI, xtitle = ifelse(CDF, "Cumulative Probability", "Exceedence Probability"), RI = FALSE, RItitle = "Recurrence Interval, in years", ytitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: probPlot(x, truncate = NA, FLIP = FALSE, distribution = "normal", alpha = 0.4, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = TRUE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = 11, CDF = !RI, xtitle = ifelse(CDF, "Cumulative Probability", "Exceedence Probability"), RI = FALSE, RItitle = "Recurrence Interval, in years", ytitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...)
probPlot(x, truncate = NA, FLIP = FALSE, distribution = "normal", alpha = 0.4, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = TRUE, yaxis.range = c(NA, NA), ylabels = 11, xlabels = 11, CDF = !RI, xtitle = ifelse(CDF, "Cumulative Probability", "Exceedence Probability"), RI = FALSE, RItitle = "Recurrence Interval, in years", ytitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: probPlot(x, truncate = NA, FLIP = FALSE, distribution = "normal", alpha = 0.4, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = TRUE, yaxis.range = c(NA, NA), ylabels = "Auto", xlabels = 11, CDF = !RI, xtitle = ifelse(CDF, "Cumulative Probability", "Exceedence Probability"), RI = FALSE, RItitle = "Recurrence Interval, in years", ytitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...)
x |
the data to plot. Missing values are allowed and ignored. |
truncate |
truncate the data at the specified value. See Details. |
FLIP |
if TRUE, then plot the cumulative distribution. Otherwise, plot as flipped data (largest values on left). |
distribution |
the name of the desired function converting from probabilities to coordinates. |
alpha |
the alpha value of the function for computing plotting positions. |
Plot |
parameters defining the characteristics of the plot. See
|
yaxis.log |
logical, if |
yaxis.range |
set the range of the y axis. See Details. |
ylabels |
set the y-axis labels. See |
xlabels |
set the x-axis labels. See |
CDF |
logical, if |
xtitle |
the x-axis title (also called x-axis caption). |
RI |
logical, if |
RItitle |
the top x-axis title if |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
parameters for the distribution function. If any parameter is specified, then an attempt is made to draw the fit between the computed distribution and the observed data. |
Truncation of the data to plot (x
) results in a conditional
probability plot. For any numeric value for truncate
, the values in
x
less than or equal to truncate
are not plotted and the
remaining values are plotted at their conditional probability (the
probability computed with all values). The behavior for the default value
for truncate
= NA, depends on yaxis.log
. If yaxis.log
is TRUE, then truncate
is treated as though it was 0; otherwise
truncate
is treated as though it was -Inf
, which results in no
truncation.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling probPlot
.
## Not run: set.seed(1) X <- rlnorm(32) setGD() probPlot(X) # For more details of probPlot see vignette(topic="ProbabilityPlots", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rlnorm(32) setGD() probPlot(X) # For more details of probPlot see vignette(topic="ProbabilityPlots", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") ## End(Not run)
Constructs information for making a nicely formatted probability axis. A support function for creating probability axes.
probPretty(x, hard = FALSE, labels = "Auto", style = "probability", exceedence = TRUE, priority = "label", distribution = "normal", ...)
probPretty(x, hard = FALSE, labels = "Auto", style = "probability", exceedence = TRUE, priority = "label", distribution = "normal", ...)
x |
axis coordinates in range 0-1 or 0-100 allowed and assumed if max(x) > 1. Note that only the range (min and max) are needed. Missing values allowed, but ignored. |
|||||
hard |
logical force min(x) and max(x) as axis limits, otherwise use "nice" limits. |
|||||
labels |
an estimate of the number of labels desired, or specific
label points. If vector, then can be expressed as character strings, which are
converted to numeric and automatically scaled. Default is "Auto", which is 9
if minimum |
|||||
style |
can be either "probability" or "percent" indicates how the labels are formatted. |
|||||
exceedence |
|
|||||
priority |
|
|||||
distribution |
the name of the probability function, defaults to normal. |
|||||
... |
options for the distribution function. |
Information about the axis labels.
Creates a quantile-quantile (q-q) or a q-normal plot.
qqPlot(x, y, alpha = 0.4, Plot = list(name = "Paired data quantiles", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), LineRef = list(name = "Line of best fit", what = "lines", color = "black"), Line1.1 = list(name = "Line of equality", what = "lines", color = "gray"), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle, ytitle, caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: qqPlot(x, y, alpha = 0.4, Plot = list(name = "Paired data quantiles", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), LineRef = list(name = "Line of best fit", what = "lines", color = "black"), Line1.1 = list(name = "Line of equality", what = "lines", color = "gray"), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle, ytitle, caption = "", margin = c(NA, NA, NA, NA), ...)
qqPlot(x, y, alpha = 0.4, Plot = list(name = "Paired data quantiles", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), LineRef = list(name = "Line of best fit", what = "lines", color = "black"), Line1.1 = list(name = "Line of equality", what = "lines", color = "gray"), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle, ytitle, caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: qqPlot(x, y, alpha = 0.4, Plot = list(name = "Paired data quantiles", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), LineRef = list(name = "Line of best fit", what = "lines", color = "black"), Line1.1 = list(name = "Line of equality", what = "lines", color = "gray"), yaxis.log = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle, ytitle, caption = "", margin = c(NA, NA, NA, NA), ...)
x |
the x-axis data, or data to plot if |
y |
the y-axis data. If missing, then produce a quantile-normal
quantile plot from the data in |
alpha |
the alpha value of the function for computing plotting positions. |
Plot |
parameters defining the characteristics of the plot. See
|
LineRef |
control parameters of the reference line (best fit between
|
Line1.1 |
control parameters for the 1:1 line. Drawn only for q-q plot. See Details. |
yaxis.log |
logical, if |
yaxis.range |
set the range of the y axis. See Details. |
xaxis.log |
logical, if |
xaxis.range |
set the range of the x-axis. See Details. |
ylabels |
set the y-axis labels. See |
xlabels |
set the x-axis labels. See |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
any additional arguments required for specific methods. |
The argument what
for either LineRef
or Line1.1
may be
set to "none" to suppress drawing of either line.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling qqPlot
.
## Not run: set.seed(1) X <- rnorm(32) setGD() qqPlot(X) # For more details of qqPlot see vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) setGD() qqPlot(X) # For more details of qqPlot see vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
Adds a reference line (vertical, horizontal, or regression) to a graph.
refLine(horizontal, vertical, coefficients, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), xrange = c(NA, NA), yrange = c(NA, NA), log10 = FALSE)
refLine(horizontal, vertical, coefficients, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE), xrange = c(NA, NA), yrange = c(NA, NA), log10 = FALSE)
horizontal |
draw horizontal lines at the specified values. |
vertical |
draw vertical lines at the specified values. |
coefficients |
draw a fitted line from the coefficients of a regression model. |
Plot |
parameters defining the characteristics of the plot. See
|
current |
the current parameters of the graph. Typically, this would be
the output from one of the graph creation functions like |
xrange |
limit x-axis range for horizontal or regression lines |
yrange |
limit y-axis range for vertical lines |
log10 |
logical, if |
Information about the graph.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() xyPlot(X, Y) # Add the 1:1 line refLine(coefficient=c(0,1)) # For more details of refLine see vignette(topic="GraphAdditions", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() xyPlot(X, Y) # Add the 1:1 line refLine(coefficient=c(0,1)) # For more details of refLine see vignette(topic="GraphAdditions", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") ## End(Not run)
Draws a box plot (support functions).
renderBoxPlot(xtoplot, stats, Box, explan, expz, yaxis.log = FALSE, yrange = c(NA, NA), xrange = range(xtoplot) + c(-1, 1), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) renderBXP(x, width, z, draw.RL = TRUE, fill = "none")
renderBoxPlot(xtoplot, stats, Box, explan, expz, yaxis.log = FALSE, yrange = c(NA, NA), xrange = range(xtoplot) + c(-1, 1), ylabels = "Auto", xlabels = "Auto", xlabels.rotate = FALSE, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA)) renderBXP(x, width, z, draw.RL = TRUE, fill = "none")
xtoplot |
the x-axis locations for each boxplot. |
stats |
a list containing the statistics for the boxplots. |
Box |
a list containing the control info for the boxplots. |
explan |
a list containing the information for an explanation. |
expz |
a list containing the information for an explanation of the boxplot. |
yaxis.log |
logical, if |
yrange |
set the y-axis range. |
xrange |
set the x-axis range. |
ylabels |
either "Auto," the approximate number of labels, or the actual labels to use for the y-axis. |
xlabels |
either "Auto" or the x-axis labels for each boxplot. |
xlabels.rotate |
logical, if |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
the parameters of the margin of the plot area. |
x |
the x-coordinate for the box. |
width |
the width of the box in x-axis units. |
z |
a list containing the statistics for the individual boxplot. |
draw.RL |
logical, if |
fill |
a character string describing the fill color for the box or "none" for no fill. |
Information about the graph.
The function renderBXP
draws a single boxplot in a graph. The
function renderBoxPlot
is called from each method function for
boxPlot
to produce the boxplot.
Draws ticks, labels, or grids for an axis (support functions).
ticks.render(arg1, side, lwd) renderY(pretty, left = list(ticks = TRUE, labels = TRUE, grid = FALSE, finegrid = FALSE), right = list(ticks = TRUE, labels = FALSE, grid = FALSE, finegrid = FALSE), lefttitle = "Y-AXIS TITLE", righttitle = "") renderX(pretty, bottom = list(ticks = TRUE, labels = TRUE, grid = FALSE, finegrid = FALSE, angle = 0), top = list(ticks = TRUE, labels = FALSE, grid = FALSE, finegrid = FALSE, angle = 0), bottitle = "X-AXIS TITLE", toptitle = "", caption = "")
ticks.render(arg1, side, lwd) renderY(pretty, left = list(ticks = TRUE, labels = TRUE, grid = FALSE, finegrid = FALSE), right = list(ticks = TRUE, labels = FALSE, grid = FALSE, finegrid = FALSE), lefttitle = "Y-AXIS TITLE", righttitle = "") renderX(pretty, bottom = list(ticks = TRUE, labels = TRUE, grid = FALSE, finegrid = FALSE, angle = 0), top = list(ticks = TRUE, labels = FALSE, grid = FALSE, finegrid = FALSE, angle = 0), bottitle = "X-AXIS TITLE", toptitle = "", caption = "")
arg1 |
control parameters for the tick locations. |
side |
the number of the axis, 1 is bottom, 2 is left, and so forth. |
lwd |
the line weight for the ticks. |
pretty |
the output from one of the "pretty" functions. |
left |
control parameters for the left y axis. |
right |
control parameters for the right y axis. |
lefttitle |
the title for the left y axis. |
righttitle |
the title for the right y axis. |
bottom |
control parameters for the bottom x axis. |
top |
control parameters for the top x axis. |
bottitle |
the title for the bottom x axis. |
toptitle |
the title for the top x axis. |
caption |
the figure caption. |
Nothing is returned.
Creates a report of any R object in a graph.
reportGraph(x, family = "Auto", size = 60 * par("csi"))
reportGraph(x, family = "Auto", size = 60 * par("csi"))
x |
any R object. |
family |
the font family to use in the report. See Details. |
size |
the size of the text, in points |
The value for family
can be any valid font family for the
device. In general "serif," "sans," "mono," and "USGS" are valid. The default,
"Auto" selects "USGS" for character vectors, and "mono" for any other object.
In contrast to other high-level graphics functions in the smwrGraphs
package, this function returns nothing because nothing is expected to be added to
the graph and nothing contributed to a possible explanation.
The report is always placed in the upper left hand corner of the graph and is left justified. If the report is longer than the height of the graph or wider than the width of the graph, then the report is truncated.
## Not run: setGD() reportGraph("Hello world!") # For more details of reportGraph see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: setGD() reportGraph("Hello world!") # For more details of reportGraph see vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Produces a graph with a fixed aspect ratio for the x- and y-axes.
scalePlot(x, y, scale = 1, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA))
scalePlot(x, y, scale = 1, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA))
x |
the x-axis data. |
y |
the y-axis data. |
scale |
the y/x ratio. See Details. |
Plot |
parameters defining the characteristics of the plot. See
|
yaxis.log |
logical, if |
yaxis.rev |
logical, if |
yaxis.range |
set the range of the y axis. See Details. |
xaxis.log |
logical, if |
xaxis.range |
set the range of the x axis. See Details. |
ylabels |
set the y-axis labels. See |
xlabels |
set the y-axis labels. See |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
The scale
argument sets the scaling ratio of the y-axis to the
x-axis. For latitude and longitude data, set the scale to
1/cos(midlat/180*pi), where midlat is the midrange of the latitude.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling scalePlot
.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() scalePlot(X, Y, Plot=list(what="points", size=0.05)) # For more details of scalePlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() scalePlot(X, Y, Plot=list(what="points", size=0.05)) # For more details of scalePlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Creates a plot of data on a yearly cycle.
seasonPlot(x, y, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = "", ylabels = 7, xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'ANY,numeric' seasonPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = c("calendar", "water", "climate"), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'character,numeric' seasonPlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = c("calendar", "water", "climate"), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
seasonPlot(x, y, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = "", ylabels = 7, xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'ANY,numeric' seasonPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = c("calendar", "water", "climate"), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'character,numeric' seasonPlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = c("calendar", "water", "climate"), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
x |
the x-coordinate data. |
y |
the y-coordinate data. |
Plot |
parameters defining the characteristics of the plot. See
|
yaxis.log |
logical, if |
yaxis.rev |
logical, if |
yaxis.range |
set the range of the y-axis. |
xaxis.range |
set the range of the x-axis. Must be one of "calendar," "water," or "climate" to set the type of year that is shown on the x-axis. |
ylabels |
set up y-axis labels. See |
xlabels |
set up x-axis labels. See Details. |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
arguments for specific methods. |
For seasonPlot
, the value for xlabels
must be one of "full," the full
month names; "abbrev," abbreviations; or "letter," the first letter of the
month. The default is "Auto," which will select an appropriate labeling scheme.
Information about the graph.
Create a seasonal plot for any valid date data and numeric y data.
Create a seasonal plot for date data in the form of month and day, like "Jan 01" or "Jaunary 01." Typically used to plot daily mean values.
A call should be made to setPage
to set up the graphics
environment before calling seasonPlot
.
To add a plot to the graph created by seasonPlot
, the x-axis data
must be expressed as decimal time relative to January 1. The function
baseDay2decimal
can be used to convert data in the form of base day
to decimal time.
setPage
, timePlot
,
baseDay2decimal
## Not run: # the months function is in lubridate X <- as.Date("2001-01-15") + months(0:11) set.seed(1) Y <- runif(12) setGD() seasonPlot(X, Y) # For more details of seasonPlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
## Not run: # the months function is in lubridate X <- as.Date("2001-01-15") + months(0:11) set.seed(1) Y <- runif(12) setGD() seasonPlot(X, Y) # For more details of seasonPlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Creates a plot of a regular series on a seasonal cycle; the annual values for each season are plotted.
seriesPlot(x, SeasonLine = list(name = "", what = "vertical", color = "black"), SeasonPoint = list(name = "", what = "points", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = 7, xlabels, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: seriesPlot(x, SeasonLine = list(name = "", what = "vertical", color = "black"), SeasonPoint = list(name = "", what = "points", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = 7, xlabels = frequency(x), xtitle = "", ytitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...)
seriesPlot(x, SeasonLine = list(name = "", what = "vertical", color = "black"), SeasonPoint = list(name = "", what = "points", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = 7, xlabels, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## Default S3 method: seriesPlot(x, SeasonLine = list(name = "", what = "vertical", color = "black"), SeasonPoint = list(name = "", what = "points", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.range = c(NA, NA), ylabels = 7, xlabels = frequency(x), xtitle = "", ytitle = deparse(substitute(x)), caption = "", margin = c(NA, NA, NA, NA), ...)
x |
data that can be treated as a regularly-spaced time series. Missing values are permitted, but result in missing seasons. |
SeasonLine |
control parameters of the lines in the plot. See Details. |
SeasonPoint |
control parameters of the points in the plot. See Details. |
yaxis.log |
logical, if |
yaxis.range |
set the range of the y axis. See Details. |
ylabels |
set the y-axis labels. See |
xlabels |
set the x-axis labels and number of seasons when |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
any additional arguments required for specific methods. |
The argument what
for SeasonLine
must be either "lines" or
"vertical." See monthplot
for more information.
The argument what
for SeasonPoint
can be set to "none" to suppress
drawing of symbols or "points" to draw symbols at the ends of the line segments
described by SeasonLine
.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling seriesPlot
.
setPage
, seasonPlot
,
monthplot
## Not run: set.seed(1) X <- rnorm(32) setGD() seriesPlot(X, xlabels=c("A", "B", "C", "D")) # For more details of seriesPlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) setGD() seriesPlot(X, xlabels=c("A", "B", "C", "D")) # For more details of seriesPlot see vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Sets up axis information (support function).
setAxis(data, axis.range, axis.log, axis.rev, axis.labels, ...)
setAxis(data, axis.range, axis.log, axis.rev, axis.labels, ...)
data |
the coordinates for the particular axis |
axis.range |
set axis range. |
axis.log |
logical, if |
axis.rev |
logical, if |
axis.labels |
set axis labels. |
... |
additional arguments to the "pretty" functions. |
Information about the axis
Checks or converts any data to valid colors (support function).
setColor(Color)
setColor(Color)
Color |
any kind of data that might be interpreted as a color. |
The values in Color
converted to a value that could be
interpreted as a color.
## Not run: # See for examples of setColor: vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of setColor: vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
Sets the default values for plot control lists (support function).
setDefaults(current = list(), ...)
setDefaults(current = list(), ...)
current |
the control parameters specified in the call to the high-level graphing function. |
... |
the default values for each name required for the control parameters. |
The control parameters with defaults substituted for missing names.
Adds the current plot information to plot control list (support function).
setExplan(current, old = NULL)
setExplan(current, old = NULL)
current |
the current plot information. |
old |
existing explanation information. |
A list having four components:
text |
a list having two components: |
text | the description in the explanation, derived from
the name component in Plot
|
cex | the size of the text to write in the explanation |
lines |
a list having seven components and controlling both lines and points: |
type | the type of plot (specifying points, lines, and so forth) |
lwd | the line weight |
lty | the line type |
pch | the symbol |
csi | the size of the symbol in inches |
cex | the the size of the symbol relative to character size |
col | the color of the plot |
areas |
a list having two components: |
fill | the color of the fill area |
borders | the color of the border |
current |
a list like |
Each entry in text
must have a corresponding entry in lines
and
areas
.
Sets up a graphics page. The functions setPage
, setRStudio
, and
setGD
set up onscreen devices. The functions setPDF
, setSweave
,
setKnitr
, and setPNG
set up files for graphics output.
setGD(name = "USGS") setKnitr(name, width, height, ...) setPDF(layout = "portrait", basename = "USGS", multiplefiles = FALSE) setPNG(name, width, height, ...) setPage(layout = "portrait", font = "preview", name = "USGS", multiple = FALSE, device = "default") setRStudio() setSweave(name, width, height, ...)
setGD(name = "USGS") setKnitr(name, width, height, ...) setPDF(layout = "portrait", basename = "USGS", multiplefiles = FALSE) setPNG(name, width, height, ...) setPage(layout = "portrait", font = "preview", name = "USGS", multiple = FALSE, device = "default") setRStudio() setSweave(name, width, height, ...)
name |
the name of the graphics page or the filename for
|
width |
the width of the graphics page. |
height |
the height of the graphics page. |
... |
additional arguments, which are ignored by |
layout |
A description of the orientation and shape of the graphics page. See Details. |
basename |
the base name of the pdf file name. |
multiplefiles |
logical, if |
font |
a description of the font. The choices are "preview," which is 12 point Arial Narrow; "USGS," which is 8 point Arial Narrow; "EST," which is 8 point Times New Roman; "PPT," which is 24 point Arial; and "PDF," which is 8 point Arial Helvetica-Narrow. "PDF" should be chosen if the graphs are to be saved to a portable document format (pdf) file. |
multiple |
logical, if |
device |
the name of the graphics device. See Details. |
If layout
is "portrait," then the page size is 8.5 by 11 inches and
the graph area is 7.25 by 9.5 inches.
If layout
is "landscape," then the page size is 11 by 8.5 inches and
the graph area is 9.5 by 7.25 inches.
If layout
is "square," then the page size is 7 by 7 inches
and the graph area is 6.5 by 6.5 inches (setPage
only).
If layout
is "slide," then the page size is 10 by 7.5 inches and the
graph area is 9.5 by 7.0 inches (setPage
only).
Layout
may also be a tagged list, with components width
and
height
giving the width and height of the page, the width and height
of the graph area is 0.5 inch less that the page, except for setPDF
where it is 0.1 inch less.
The user may specify a graphics device other than the default for the system. This may be necessary when running under certain user environments like RStudio (TM).
For setPage
and setPDF
, a list with two components:
dev, the device number; and name, the name or basename. For setGD
setSweave
, setKnitr
, setPNG
, and setRStudio
nothing is returned.
The focus of all of the graphics functions is on producing near-publication
ready figures for U.S. Geological Survey (USGS) report series. The function setPDF
should be used to create the PDF files for those figures. The fonts that are used in
graphs created by calling setPDF
closely mimic those required in USGS reports.
One peculiarity of the fonts is that bold expressions do not appear bold in the PDF, but
the font is tagged bold.
The functions setSweave
, setKnitr
, and setPNG
are graphics set up functions to be used when using Sweave
,
knitr
and markdown
, respectively. The functions
setSweave
and setPDF
require a call to dev.off
to
close the graphics device after all graphics are completed; knitr
and markdown
automatically close the graphics device, so the call
to dev.off
is not needed in those scripts.
The function setRStudio
is designed to set up the default graphics
device in RStudio rather than open a separate graphics screen. This is useful
for preview only as some features of the graphics system cannot be replicated
on that graphics device.
The function setGD
is designed to be a quick and easy
graphics page setup function. It is designed to be used by functions to set
up the graphics environment if the user fails to do so.
## Not run: # See for examples of setGD: demo(topic="AnnualFlowBarChart", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="Coplot-simpleBoxPlot", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") # See for examples of setPage: demo(topic="PiperScript", package="smwrGraphs") # See for examples of setPDF: demo(topic="MeasurementRating", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") # See for examples of setSweave: vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="DateAxisFormats", package="smwrGraphs") vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of setGD: demo(topic="AnnualFlowBarChart", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="Coplot-simpleBoxPlot", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") demo(topic="FlowDur-Measurements", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") # See for examples of setPage: demo(topic="PiperScript", package="smwrGraphs") # See for examples of setPDF: demo(topic="MeasurementRating", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") # See for examples of setSweave: vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="DateAxisFormats", package="smwrGraphs") vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") vignette(topic="ProbabilityPlots", package="smwrGraphs") ## End(Not run)
Sets up a specific graph on a graphics device.
setGraph(graphNum, layout, noTicks = NULL)
setGraph(graphNum, layout, noTicks = NULL)
graphNum |
the number of the graph. |
layout |
the layout of the graph. |
noTicks |
suppress ticks on a specific axis. |
The parameters of the margin of the plot area.
This function is called using the information generated by
setLayout
. It invisibly sets up the graphics device for the next
graph.
## Not run: # See for examples of setGraph: vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of setGraph: vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
Sets plot control list for groups of data (support function).
setGroupPlot(current, Grps = 1, name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black")
setGroupPlot(current, Grps = 1, name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black")
current |
the plot parameters specified in the call to the high-level graphing function. |
Grps |
the number of groups. |
name |
the name associated with the group. See Details. |
what |
what kind of plot. Must be one of "points," symbols only; "lines," line segments connecting points only; "both," line segments connecting isolated symbols; "overlaid," line segments connecting points with symbols; "stairstep," stairstep line segments; or "vertical," vertical lines from the y-axis origin to the y value at each x value. |
type |
the type of line, if drawn. Must be one of "solid," "dashed," "dotted." |
width |
the width of line, if drawn. Must be one of "standard,"
resulting in a line width of about 0.7 points; "color," resulting in a line
width of about 0.8 points; "bold," resulting in a line width of about 1.
point; or "hairline" resulting in a line width of about 0.5 points. Note
these values are doubled if the |
symbol |
type symbol, if drawn. Must be one of "circle," "uptri" (upward pointing triangle), "plus," "x," "diamond," "downtri" (downward pointing triangle), "square," or "dot." |
filled |
logical, if |
size |
the size of the symol in inches, if drawn. |
color |
the color of the plotted values for each group. Can be a named color, such as "black" or "gray50" or an RGB color like "#A09623." |
If the name
component in the original call to the high-level plot is
"Auto," then the description for the explanation is taken from the value in
the Group
argument in that call. Otherwise the user must specify a
name for each group.
If the color
component in the original call
to the high-level plot is "Auto," then the colors for each group are based
on a sequence of 15 colors that are easily distinguished from each other. If
there are more than 15 groups, then a gray scale is used with no guarantee
of easily distinguished colors.
A list having two components:
current |
a list like
|
Explan |
a list for creating an explanation |
setExplan
, for details about the list required for an
explanation.
Set up the layout of one or more graphs on a page.
setLayout(width = NULL, height = NULL, num.cols = max(1, length(width)), num.rows = max(1, length(height)), num.graphs = num.rows * num.cols, explanation = NULL, shared.x = -1, shared.y = -1, yleft = 3.5, yright = NA, xbottom = 3.2, xtop = NA)
setLayout(width = NULL, height = NULL, num.cols = max(1, length(width)), num.rows = max(1, length(height)), num.graphs = num.rows * num.cols, explanation = NULL, shared.x = -1, shared.y = -1, yleft = 3.5, yright = NA, xbottom = 3.2, xtop = NA)
width |
the width of the graph area, exclusive of any explanation. Can be either the total width or the width of each column of graphs. If NULL, then use default figure width. See Details. |
height |
the height of the graph area, exclusive of explanation. Can be either the total width or the height of each row of graphs. If NULL, then use defualt figure height. |
num.cols |
the number of columns in the rectangular array of graphs. Computed from width if not supplied. |
num.rows |
the number of rows in the rectangular array of graphs. Computed from height if not supplied. |
num.graphs |
the number of actual graphs in the rectangular array of graphs. Computed from |
explanation |
a description of where to place the explanation if put into a separate graph. See Details. |
shared.x |
indicate how the x axes are to be shared. See Details. |
shared.y |
indicate how the y axes are to be shared. If < 0, then no sharing–each has own axis labels, etc. If = 0, then axes in direct contact. If > 0, then the value indicates the relative spacing. |
yleft |
space to allocate on the left margin of each graph. |
yright |
space to allocate on the right margin of each graph. See Details. |
xbottom |
space to allocate on the bottom margin of each graph. |
xtop |
space to allocate on the top margin of each graph. See Details. |
The layout of multple graphs on a page is always set up as a rectangular
grid. The columns can be specified in one of two ways, either by specifying
the width of each column using width
or setting equal-width columns
by specifying num.cols
. The rows can be specified in one of two ways,
either by specifying the height of each column using height
or
setting equal-height rows by specifying num.rows
.
If an explanation is to be placed outside of the graphs, then explanation
is used to indicate where the explanation is to be placed. The explanation
can be placed either to the right of the grid of graphs, at the bottom of
the grid, or in one of the grid cells.
To place an explanation to the
right of the graphs, explantion
should be set to
list(right=ewid)
, where ewid
is the width of the explanation.
In this case, the total of width
and ewid
must be less that
the total available for the page.
To place an explanation at the bottom
of the graphs, explantion
should be set to list(bottom=ehei)
,
where ehei
is the height of the explanation. In this case, the total
pf height
and ehei
must be less than the total available for
the page.
To place an explanation within a cell of the grid,
explantion
should be set to list(grid=enum)
, where enum
is the cell number in the grid. Cell numbers are sequential starting in the
upper left and increasing by column. In this case num.graphs
must be
set to some number less than num.cols
times num.rows
.
The width of the explanation can be estimated by allocating 1 inch per 13
characters for font
set to "preview" or 1 inch per 17 characters for
font
set to "USGS" plus 0.5 inch for the symbols. The width for box
plots should be 2 inches for any type other that "tukey" and 2.5 inches for
"tukey." The height of the explanation can be estimated as 1 inch per 8
lines of explanation for font
set to "preview" and 1 inch per 10
lines of explanation for font
set to "USGS"—allocate an extra 2
lines for the title. Box plots require about 3 inches for the truncated and
simple types and about 4.5 inches for type "tukey" and about 4 inches for
type "extended." The plot area within each cell is set up to have consistent
widths within each column and consistent heights within each row.
The arguments yleft
, yright
, xbottom
, and xtop
are used to set up the plot area margins. If axes are not shared, then the
margin values are set for any graph using those values. If the
axes are shared, then the margin values apply to the corresponding left
column, right column, bottom row or top row. The values for yleft
and
xbottom
are useful defaults. If the y-axis labels are wider than typical
values, such as those for very large numbers or names, then the value for yleft
should be increased. If the x-axis labels are rotated, then the value for
xbottom
should be increased.
The arguments shared.x
and shared.y
control axis sharing. If the values
are negative, then the axes are not shared and the margins are set as described in the
preceding paragraph. If the values are nonnegative, then the axes are shared and the
margin is set by the value. For example, a value of 0 means the axes are touching.
A value of 1 generally gives enough spacing between the plots to prevent overlapping
labels.
The axis ticks and labels can be supressed by setting the margins to a negative
value. This is most useful when adding right-axes with addXY
for example.
The value for yright
can be set using the setRtMargin
function if adding a plot using the secondary right axes; extract
the fourth element of the returned value. The default is to
set a narrow right-hand margin.
The value for xtop
can be set to -2.2 if adding a plot using the
secondary top axis. The default is to set the margin to 1.5, which allows
only for a graph title.
an object of class "Layout" with three named components and
num.graphs
numbered
components:
explanation and each numbered component |
a list with two components: |
margin |
the margin for the plot area |
fig |
the figure area |
size |
the size of the overall figure |
mat |
the figure layout |
It is very easy to confuse the graph number, used by setGraph
and the grid cell number referenced in setlayout
. The grid cell
number always ranges from 1 to the number of columns times the number of
rows. The graph number ranges from 1 to num.graphs
and skips the
grid cell number if defined in the explanation
argument. Printing the
output object can help understand the graph layout.
There is nothing special about the cell allocated for the explanation; it has no special characteristics, therefore an explantion can be placed in any graph numbered cell and anything can be placed in the "explanation" cell. As an example, the "explanation" at the bottom of the figure can be used for a description of the figure that is more than one line in height.
setPage
, setGraph
, setRtMargin
,
addTitle
## Not run: # See for examples of setLayout: vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of setLayout: vignette(topic="BoxPlots", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="PiperPlot", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") demo(topic="PiperScript", package="smwrGraphs") ## End(Not run)
Sets the margins for the plot area (support function).
setMargin(margin, yax, aux.label = FALSE, caption = TRUE)
setMargin(margin, yax, aux.label = FALSE, caption = TRUE)
margin |
incomplete plot margin specification, generally computed by
|
yax |
the y-axis information from a "pretty" function, required if the
second entry of |
aux.label |
logical, if |
caption |
logical, if |
Complete plot margin specification.
Sets plot control list for individuals in data (support function).
setMultiPlot(current, Nobs = 1, name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black", order = "as is")
setMultiPlot(current, Nobs = 1, name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black", order = "as is")
current |
the plot parameters specified in the call to the high-level graphing function. |
Nobs |
the number of observations. |
name |
the name associated with the observation. See Details. |
what |
what kind of plot. Must be one of "points," symbols only; "lines," line segments connecting points only; "both," line segments connecting isolated symbols; "overlaid," line segments connecting points with symbols; "stairstep," stairstep line segments; or "vertical," vertical lines from the y-axis origin to the y value at each x value. |
type |
the type of line, if drawn. Must be one of "solid," "dashed," "dotted." |
width |
the width of the line, if drawn. Must be one of "standard,"
resulting in a line width of about 0.7 points; "color," resulting in a line
width of about 0.8 points; "bold," resulting in a line width of about 1
point; or "hairline" resulting in a line width of about 0.5 points. Note
these values are doubled if the |
symbol |
type symbol, if drawn. Must be one of "circle;" "uptri," upward pointing triangle; "plus;" "x;" "diamond;" "downtri," downward pointing triangle; "square;" or "dot." |
filled |
logical, if |
size |
the size of the symol in inches, if drawn. |
color |
the color of the plotted values. Can be a named color, such as "black" or "gray50" or an RGB color like "#4056FF." |
order |
specify the order of the symbols in the explanation. Can be "as is'–do nothing to order in explanation, "sort" or "increasing"—put into sorted order, "decreasing"— put in reverse order; or a vector theat specifies the exact order. |
Each of the arguments from name
through color
must have one
entry for each observation. If a single value is given, then it is
replicated for each observation. In general, it is convenient to set up a
data frame with columns for group names with common values for the line or
symbol. It is required that each group have common values for the line or
symbol.
A list having two components:
current |
a list like
|
Explan |
a list for creating an explanation |
colors
for a list of color names,
setExplan
, for details about the list required for an
explanation.
Sets the plot control list (support function).
setPlot(current, name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black", area.color = NA, area.border = NA)
setPlot(current, name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black", area.color = NA, area.border = NA)
current |
list containing the current plot information or those requested by the user. |
name |
the name of the object plotted; used in the explanation. Expressions
can be used, but if used, then |
what |
what to plot, see Details. |
type |
the line type, if drawn, must be one of "solid," "dashed," or "dotted." |
width |
the width of the line, if drawn, must be one of "standard;" "color," a little wider than "standard;" "bold," substantially wider than "standard;" or "hairline," used for ticks and borders. |
symbol |
the symbol to plot, if drawn, see Details. |
filled |
logical, if |
size |
the size of the symbol, in inches, if drawn. |
color |
the color of the symbol or line. |
area.color |
the color of a shaded area, required for completeness. |
area.border |
the boundary color of a shaded area, required for completeness. |
The value for what
must be one of:
symbols only,
lines only,
lines connecting symbols with a small gap,
lines connecting symbols,
horizontal line to next x value with a vertical line to the y value,
vertical lines from y equal 0 only.
draw nothing
The value for symbol
must be one of:
an open or filled circle, depending on
filled
,
an open or filled up pointing triangle,
depending on filled
,
a plus sign (never filled),
an x (never filled),
an open or filled diamond
shape, depending on filled
,
an open or filled
down pointing triangle, depending on filled
,
an open
or filled square, depending on filled
,
a very small dot (never filled),
a plus sign (never filled),
no symbol or line.
A list like current
, but with the defaults supplied for any
missing component.
Vertical lines drawn by setting what
to "vertical" are drawn from
y equal 0 to each y value. The user will have more control over vertical lines by
using the addBars
function and setting the bar width to 0.
xyPlot
, timePlot
, qqPlot
,
piperPlot
, probPlot
, colorPlot
,
addBars
Sets the right or top margin for graphs with secondary axes. Used After setting up the graphics environment, but before the call to the high-level graphics function to allocate space for an additional label and title.
setRtMargin(y, margin = c(NA, NA, NA, NA), right.labels = 7, right.log = FALSE, right.range = c(NA, NA)) setTopMargin(margin = c(NA, NA, NA, NA))
setRtMargin(y, margin = c(NA, NA, NA, NA), right.labels = 7, right.log = FALSE, right.range = c(NA, NA)) setTopMargin(margin = c(NA, NA, NA, NA))
y |
the secondary y-axis data to be plotted, missing values are permitted and are ignored. |
margin |
incomplete plot margin specification, generally computed by
|
right.labels |
set up right-axis labels; the approximate number of labels. |
right.log |
logical, if |
right.range |
set right-axis range. |
The values for right.labels
, right.log
, and right.range
should be set exactly as in the call to addXY
.
The margin
is a numeric vector of length 4 specifying the bottom, left, top,
and right margins around the plot, as decriibed in by the mar
option in
par
. The function setTopMargin
only changes the third value and
the function setRtMargin
only changes the fourth value. The value for
margin
is typically the output from setGraph
or the defaults for
these functions.
The updated margin; only the right margin value is changed.
## Not run: # See for examples of setRtMargin: demo(topic="RightAxisExample", package="smwrGraphs") # See for examples of setTopMargin: demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of setRtMargin: demo(topic="RightAxisExample", package="smwrGraphs") # See for examples of setTopMargin: demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)
Set up a scatter plot matrix.
setSplom(size = NULL, num.variables, show.all = FALSE, touching = TRUE, explanation = NULL, ymargin = 3.5)
setSplom(size = NULL, num.variables, show.all = FALSE, touching = TRUE, explanation = NULL, ymargin = 3.5)
size |
the width and height of the entire graph area, exclusive of explanation. If NULL, then use minimum of figure width and height. |
num.variables |
the number of variables to plot. |
show.all |
logical, if |
touching |
logical, if |
explanation |
a description of where to place the explanation if needed. See Details. |
ymargin |
the left-margin for the plot area for the left column of graphs. |
If an explanation is needed, then explanation
is used to indicate
where the explanation is to be placed. The explanation can be placed either
to the right of the grid of graphs, at the bottom of the grid, or in one of
the grid cells.
To place an explanation to the right of the graphs,
explantion
should be set to list(right=ewid)
, where
ewid
is the width of the explanation. In this case, the total of
width
and ewid
must be less than the total available for the
page.
To place an explanation at the bottom of the graphs,
explantion
should be set to list(bottom=ehei)
, where
ehei
is the height of the explanation. In this case, the total pf
height
and ehei
must be less than the total available for the
page.
To place an explanation within a cell of the grid,
explantion
should be set to list(grid=enum)
, where enum
is the cell number in the grid. Cell numbers are sequential starting in the
upper left and increasing by column. In this case num.graphs
must be
set to some number less than num.cols
times num.rows
.
a list like setLayout
with three additional components:
show.all
, touching
, and num.variables
from the call to
setSplom
.
## Not run: # A simple example library(smwrData) data(IonBalance) setGD() # set up a simple graphics page AA.lo <- with(IonBalance, setSplom(num.variables=3, touching=FALSE)) with(IonBalance, splomPlot(cbind(Ca, Mg, Na), Panel=list(line="slr"), layout=AA.lo)) # See for another example of setSplom: vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
## Not run: # A simple example library(smwrData) data(IonBalance) setGD() # set up a simple graphics page AA.lo <- with(IonBalance, setSplom(num.variables=3, touching=FALSE)) with(IonBalance, splomPlot(cbind(Ca, Mg, Na), Panel=list(line="slr"), layout=AA.lo)) # See for another example of setSplom: vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Generates a sequence of colors along a specified range.
greenRed.colors(n, alpha = 1) redGreen.colors(n, alpha = 1) blueRed.colors(n, alpha = 1) redBlue.colors(n, alpha = 1) warmCool.colors(n, alpha = 1) coolWarm.colors(n, alpha = 1) pastel.colors(n, alpha = 1)
greenRed.colors(n, alpha = 1) redGreen.colors(n, alpha = 1) blueRed.colors(n, alpha = 1) redBlue.colors(n, alpha = 1) warmCool.colors(n, alpha = 1) coolWarm.colors(n, alpha = 1) pastel.colors(n, alpha = 1)
n |
the number of colors to generate. |
alpha |
a measure of the intensity of the generated colors |
A sequence of character strings indicating the colors.
blueRed.colors
generates a sequence from blue to red through
magenta. redBlue.colors
generates a sequence from red to blue through
magenta. coolWarm.colors
generates a sequence from blue to red
through green. warmCool.colors
generates a sequence from red to blue
through green. greenRed.colors
generates a sequence from green to red
through yellow. redGreen.colors
generates a sequence from red to
green through yellow. pastel.colors
genereates a sequence of
well-separated pastel colors useful for areas or bars.
## Not run: redGreen.colors(2) blueRed.colors(2) # For examples of warmCool.colors in graphs see demo(topic="DurationHydrograph", package="smwrGraphs") # All have similar usage ## End(Not run)
## Not run: redGreen.colors(2) blueRed.colors(2) # For examples of warmCool.colors in graphs see demo(topic="DurationHydrograph", package="smwrGraphs") # All have similar usage ## End(Not run)
Produces a matrix of scatter plots
splomPlot(x, layout, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), Panel = list(), axis.log = FALSE, axis.range = c(NA, NA), labels = 5, caption = "")
splomPlot(x, layout, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.05, color = "black"), Panel = list(), axis.log = FALSE, axis.range = c(NA, NA), labels = 5, caption = "")
x |
the data to plot, must be either a matrix or a data frame. |
layout |
the output from |
Plot |
parameters defining the characteristics of the plot. See
|
Panel |
a list or a function, see Details. |
axis.log |
log-transform the x and y axis for all plots. |
axis.range |
set x- and y-axis ranges for all plots. |
labels |
set the number of labels for both the x and y axes. See
|
caption |
the figure caption. |
Panel
may be a tagged list, with any one of these options:
loess=span, where span is the span argument to loess.smooth;
line=opt,
where opt='slr' for simple linear regression, or 'loc' for line of organic
correlation, or '1:1' for the 1:1 line.
The format of the lines is taken
from Plot
.
Panel
may also be a function with 3
arguments, x, y, and current, that adds to the plot and returns updated plot
information. The function is called for each individual plot.
Information about the graph.
A call must be made to setPage
and to setSplom
to set up
the graphics environment before calling splomPlot
.
## Not run: # See for examples of splomPlot: vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of splomPlot: vignette(topic="LineScatter", package="smwrGraphs") ## End(Not run)
Adds a Stiff diagram to an existing graph or produces a tabular presentation of Stiff diagrams in a graph.
stiffPlot(cations, anions, Stiff = list(fill = "gray50", outline = "black", height = 2/3, bar = "black"), yaxis.orient = "table", yaxis.order = "none", xaxis.range = c(NA, NA), ylabels = "Auto", xlabels = 7, catlabels = "Auto", anlabels = "Auto", xtitle = "Milliequivalents per liter", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) addStiff(x, y, width, height, cations, anions, Stiff = list(fill = "gray50", outline = "black", height = 2/3, bar = "black"), xaxis.range = c(NA, NA), catlabels = "", anlabels = "", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
stiffPlot(cations, anions, Stiff = list(fill = "gray50", outline = "black", height = 2/3, bar = "black"), yaxis.orient = "table", yaxis.order = "none", xaxis.range = c(NA, NA), ylabels = "Auto", xlabels = 7, catlabels = "Auto", anlabels = "Auto", xtitle = "Milliequivalents per liter", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) addStiff(x, y, width, height, cations, anions, Stiff = list(fill = "gray50", outline = "black", height = 2/3, bar = "black"), xaxis.range = c(NA, NA), catlabels = "", anlabels = "", current = list(yaxis.log = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))
cations |
a matrix of cation data. Each row corresponds to the
respective |
anions |
a matrix of anion data. Each row corresponds to the respective
|
Stiff |
a list describing the Stiff diagram. See Details. |
yaxis.orient |
orientation of the y-axis values, must be either "table" or "grid." "Table" is sorted from top to bottom, "grid" is sorted from bottom to top. |
yaxis.order |
the order of the y-axis values, must be one of "none," "ascending," or "descending." |
xaxis.range |
the range of the x-axis corresponding to |
ylabels |
set up y-axis labels. |
xlabels |
set up x-axis labels. |
catlabels |
labels for the values of the cations. For |
anlabels |
labels for the values of the anions. For |
xtitle |
x-axis title (also called x-axis caption). |
ytitle |
y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
not used, required for other methods. |
x |
the x-coordinates to place the center of each Stiff diagram. Missing values are permitted, but result in no Stiff diagram. |
y |
the y-coordinates to place the center of each Stiff diagram. Missing values are permitted, but result in no Stiff diagram. |
width |
the width in inches of the Stiff diagrams. |
height |
the height in inches of the Stiff diagrams. |
current |
the current plotting parameters. Typically, this would be the
output from one of the graph creation functions like |
The units of the cation and anion data are generally in milli-equivalents per liter.
The Stiff
argument must be a tagged list with these components:
the name of the color to fill each Stiff diagram. Must be a valid color name.
the name of the color to draw the outline or border for each Stiff diagram. Must be a valid color name.
the height of each Stiff diagram, proportional to the overall height for each Stiff diagram.
the color of the central bar. May be "none" for no central bar.
The values for axis.range
must be expressed as a negative value for the
cation
data, left-hand side of the diagram, and a positive value for
anion
data, right-hand side of the diagram.
Information about the graph.
Hem J.D., 1989, Study and interpretation of the chemical characteristics of natural water: U.S. Geological Survey Water-Supply Paper 2254, 263 p.
## Not run: # See for examples of stiffPlot: vignette(topic="PiperPlot", package="smwrGraphs") # See for examples of addStiff: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of stiffPlot: vignette(topic="PiperPlot", package="smwrGraphs") # See for examples of addStiff: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Removes leading and trailing blanks from a character string.
strip.blanks(x)
strip.blanks(x)
x |
a character vector. |
A vector like x
, but with leading and trailing spaces removed
from each element.
link[base]{sub}
strip.blanks(" keep me ")
strip.blanks(" keep me ")
Creates a surface plot to show three-dimensional data or a colored surface plot to show four-dimensional data.
surfacePlot(pre, z.color = "lightblue", Surface = list(name = "", lineColor = "black", levels = 20, ramp = "coolWarm"), xtitle = "", ytitle = "", ztitle = "", margin = c(NA, NA, NA, NA), caption = "")
surfacePlot(pre, z.color = "lightblue", Surface = list(name = "", lineColor = "black", levels = 20, ramp = "coolWarm"), xtitle = "", ytitle = "", ztitle = "", margin = c(NA, NA, NA, NA), caption = "")
pre |
the output from |
z.color |
the surface color. Can be either a character string indicating the
color of the surface, or a numeric matrix. If a matrix, then must have
|
Surface |
control parameters for the surface. See Details. |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
ztitle |
the z-axis title (also called z-axis caption). |
margin |
set up the plot area margins. To allocate space for a graph title,
set the third value to 1.5, otherwise all values should be |
caption |
the figure caption. |
If z.color
is a numeric matrix, then the values represent the average
surface of the grid defined by x
and y
, that is it represents the
value one-half way between each value of x
and one-half way between each
value of y
, the mid point. If it has the same dimensions as z.surf
,
then the data are resampled by averaging each of the four corners to compute the
mid point value. The values of z.color
are assigned using the controls
in Surface
.
The Surface
argument must be a tagged list with these components:
the name of z.color
used in the explanation.
the color for each line on the surface. If "none," then lines are not drawn.
the levels of the surface colors. May be either a single numeric value that indicates the approximate number of levels, or a vector that indicates the exact breaks in the levels.
the name of the color ramp. May be "gray" or "grey" for a gray
scale or the prefix name of a function that creates a range of colors, see
coolWarm.colors
for examples.
Information about the graph.
A call must be made to setPage
or setPDF
to set up the
graphics environment before calling surfacePlot
.
## Not run: # See for examples of surfacePlot: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of surfacePlot: vignette(topic="GraphGallery", package="smwrGraphs") ## End(Not run)
Produces a ternary diagram, also called a trilinear or triangular diagram.
ternaryPlot(x, y, z, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), axis.range = c(0, 100), num.labels = 6, ticks = TRUE, grids = !ticks, orient = "c", xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), ztitle = deparse(substitute(z)), units.title = "Percent", caption = "", margin = c(NA, NA, NA, NA))
ternaryPlot(x, y, z, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), axis.range = c(0, 100), num.labels = 6, ticks = TRUE, grids = !ticks, orient = "c", xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), ztitle = deparse(substitute(z)), units.title = "Percent", caption = "", margin = c(NA, NA, NA, NA))
x |
the x-axis (bottom) data. |
y |
the y-axis (left side) data. |
z |
the z-axis (right side) data. Note that |
Plot |
control parameters of the plot, see |
axis.range |
the range of the axes. Must be either c(0, 1) or c(0, 100). |
num.labels |
the number of labels to draw on each axis. Best selections are 2 giving (0, 100), 3 (0, 50, 100), 5 (0, 25, 50, 75, 100), or 6 (o, 20, 40, 60, 80, 100). |
ticks |
logical, if |
grids |
logical, if |
orient |
the orientation of the graph. Must be "c" for clockwise or "a" for anti- or counter-clockwise |
xtitle |
title (also called caption) for the x-axis. |
ytitle |
title (also called caption) for the y-axis. |
ztitle |
title (also called caption) for the z-axis. |
units.title |
the units titles, should be either "Percent" of
"Proportion" depending on |
caption |
the figure caption. |
margin |
set up the plot area margins— ignored, included for consistency with other plotting functions in this package. |
The what
component of the Plot
argument must be either
"points" or "none."
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling piperPlot
.
Lorenz D.L., 2015, smwrGraphs
setPage
, setMultiPlot
,
piperPlot
, addTernary
## Not run: # See for examples of ternaryPlot: vignette(topic="PiperPlot", package="smwrGraphs") ## End(Not run)
## Not run: # See for examples of ternaryPlot: vignette(topic="PiperPlot", package="smwrGraphs") ## End(Not run)
Plots the trilinear diagram in the Piper diagram (support function).
ternarySubplot(x, y, z, what = "points", symbol = rep(1, length(x)), color = rep(1, length(x)), size = rep(0.05, length(x)), axis.range = c(0, 100), num.labels = 6, ticks = FALSE, grids = !ticks, orient = "c", xtitle = "x", ytitle = "y", ztitle = "z", plot = TRUE)
ternarySubplot(x, y, z, what = "points", symbol = rep(1, length(x)), color = rep(1, length(x)), size = rep(0.05, length(x)), axis.range = c(0, 100), num.labels = 6, ticks = FALSE, grids = !ticks, orient = "c", xtitle = "x", ytitle = "y", ztitle = "z", plot = TRUE)
x |
the x-ccordinate values. |
y |
the y-coordinate values. |
z |
the z-coordinate values. |
what |
the type of plot, must be either "points," "lines," or "none." |
symbol |
the symbol to use if |
color |
the color of the plot. |
size |
the size of the symbol if |
axis.range |
the range of the axes. Must be either c(0, 1) or c(0, 100). |
num.labels |
the number of labels to draw on each axis. |
ticks |
logical, if |
grids |
logical, if |
orient |
a single character, "c" indicates clockwise orientation for
|
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
ztitle |
the z-axis title (also called z-axis caption). |
plot |
plot the data? |
Support function, to be called only from piperPlot
.
If plot
is TRUE, then the range of the user coordinates.
Otherwise, the x
, y
, and z
values are converted to
2-dimensional values.
Creates a plot of time-series data.
timePlot(x, y, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'Date,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'POSIXt,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'integer,numeric' timePlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE) + c(-1, 1), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), xlabels.rotate = FALSE, ...) ## S4 method for signature 'difftime,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "Auto", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
timePlot(x, y, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'Date,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'POSIXt,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'integer,numeric' timePlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE) + c(-1, 1), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), xlabels.rotate = FALSE, ...) ## S4 method for signature 'difftime,numeric' timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "Auto", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)
x |
the time/date data. |
y |
the y-axis data. |
Plot |
parameters defining the characteristics of the plot. See
|
yaxis.log |
logical, if |
yaxis.rev |
logical, if |
yaxis.range |
set the range of the y-axis. See Details. |
xaxis.range |
set the range of the x-axis. Set at January 1 through
December 31 for |
ylabels |
set up y-axis labels. See |
xlabels |
set up x-axis labels. See Details for details for valid values. |
xtitle |
the x-axis title (also called x-axis caption). Generally should be blank as titles are typically set up by the axis labeling routines. |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
arguments for specific methods. |
xlabels.rotate |
logical, if |
For the timePlot
methods where the time/date data are of class "Date,"
"POSIXt," or "numeric," the values for xlabels
must be one of
"hours," "days," "months," "years," "water years," or "Auto," which will
select an appropriate axis labeling scheme based on the time span of the data.
May also be a list of valid arguments to datePretty
for finer control.
For the timePlot
method where the time/date data are of class "integer,"
the value for xlabels
must be one of "Auto," a number indicating the approximate
number of labels, or a list of valid arguments to linearPretty
for finer control.
For the timePlot
method where the time/date data are of class "difftime,"
the value for xlabels
must be one of "Auto" or a number indicating the approximate
number of labels.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph.
Create a time-series plot for Date and numeric data.
Create a time-series plot for POSIXt and #' numeric data.
Create a time-series plot for dates in decimal format and numeric data.
Create a time-series plot for annual summaries of numeric data.
Create a time-series plot for difftime and numeric data.
The function timePlot
produces a time-series plot. The function
seasonPlot
produces a plot of the annual cycle. There is no function
in the smwrGraphs package that will automatically transform time/date data
to the correct seasonal value; use dectime(x) - trunc(dectime(x))
,
where x
is the time/date variable.
## Not run: # the months function is in lubridate X <- as.Date("2001-01-15") + months(0:11) set.seed(1) Y <- runif(12) setGD() timePlot(X, Y) # For more details of timePlot see vignette(topic="DateAxisFormats", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") demo(topic="AnnualFlowBarChart", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") ## End(Not run)
## Not run: # the months function is in lubridate X <- as.Date("2001-01-15") + months(0:11) set.seed(1) Y <- runif(12) setGD() timePlot(X, Y) # For more details of timePlot see vignette(topic="DateAxisFormats", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") demo(topic="AnnualFlowBarChart", package="smwrGraphs") demo(topic="DurationHydrograph", package="smwrGraphs") demo(topic="HydroPrecip", package="smwrGraphs") demo(topic="RightAxisExample", package="smwrGraphs") ## End(Not run)
Constructs information for making a nicely formatted date/time axis.
timePretty(x, labels = "Auto")
timePretty(x, labels = "Auto")
x |
time difference data |
labels |
either "Auto," which lets the function decide how many labels, the approximate number of labels, or the actual labels to use. |
Information about the axis labels.
Transforms numeric data to match any axis scaling (support function).
transData(data, logT = FALSE, revT = FALSE, trans = as.vector, transarg = NULL)
transData(data, logT = FALSE, revT = FALSE, trans = as.vector, transarg = NULL)
data |
data for axis |
logT |
logical, if |
revT |
logical, if |
trans |
arbitrary transform function to apply to |
transarg |
list of arguments to |
A vector like data
transformed to plot correctly on an axis.
Creates an x-y plot using arbitrary monotonic transforms for the axes.
transPlot(x, xtrans, xinv, xtargs = NULL, y, ytrans, yinv, ytargs = NULL, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.range = c(NA, NA), xaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA))
transPlot(x, xtrans, xinv, xtargs = NULL, y, ytrans, yinv, ytargs = NULL, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.range = c(NA, NA), xaxis.range = c(NA, NA), ylabels = "Auto", xlabels = "Auto", xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA))
x |
the x-axis data. |
xtrans |
the transformation function for the x-axis. |
xinv |
the inverse transformation for the x-axis. |
xtargs |
additional arguments to |
y |
the y-axis data. |
ytrans |
the transformation function for the y-axis. |
yinv |
the inverse transformation for the y-axis. |
ytargs |
additional arguments to |
Plot |
parameters defining the characteristics of the plot. See
|
yaxis.range |
set the range of the y-axis. |
xaxis.range |
set the range of the x-axis. |
ylabels |
set up y-axis labels. See |
xlabels |
set up x-axis labels. See |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
Information about the graph.
A call should be made to setPage
to set up the graphics
environment before calling transPlot
.
## Not run: X <- seq(.25, 9.75, by=.25) setGD() # The Box-Cox transform (power of 1.5) # The labels represent the original values; the line represents the transformed value transPlot(X, I, I, y=X, ytrans=boxCox, yinv=IboxCox, ytargs=list(lambda=1.5, GM=1), Plot=list(what="lines")) # For more details of transPlot see demo(topic="MeasurementRating", package="smwrGraphs") ## End(Not run)
## Not run: X <- seq(.25, 9.75, by=.25) setGD() # The Box-Cox transform (power of 1.5) # The labels represent the original values; the line represents the transformed value transPlot(X, I, I, y=X, ytrans=boxCox, yinv=IboxCox, ytargs=list(lambda=1.5, GM=1), Plot=list(what="lines")) # For more details of transPlot see demo(topic="MeasurementRating", package="smwrGraphs") ## End(Not run)
Constructs information for making a nicely formatted numeric axis.
transPretty(x, hard = FALSE, labels = 11, style = "none", func = log, Ifunc = exp, ...)
transPretty(x, hard = FALSE, labels = 11, style = "none", func = log, Ifunc = exp, ...)
x |
data defining the range to be plotted on the axis. Missing value are permitted, but ignored. |
hard |
logical, if |
labels |
either "Auto," which lets the function decide how many labels, the approximate number of labels, or the actual labels to use. |
style |
a character string indicating the style of the axis labels if
they are not specifically listed in |
func |
the forward transform function. |
Ifunc |
the backward (inverse) transform function. |
... |
additional arguments to |
Information about the axis lables.
Creates a line/scatter plot.
xyPlot(x, y, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric,numeric' xyPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'factor,numeric' xyPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), xlabels.rotate = FALSE, ...) ## S4 method for signature 'character,numeric' xyPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), xlabels.rotate = FALSE, ...)
xyPlot(x, y, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = "", ytitle = "", caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'numeric,numeric' xyPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = 7, xtitle = deparse(substitute(x)), ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...) ## S4 method for signature 'factor,numeric' xyPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), xlabels.rotate = FALSE, ...) ## S4 method for signature 'character,numeric' xyPlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.log = FALSE, xaxis.range = c(NA, NA), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), xlabels.rotate = FALSE, ...)
x |
the x-axis data to plot. |
y |
the y-axis data to plot. |
Plot |
parameters defining the characteristics of the plot. See
|
yaxis.log |
logical, if |
yaxis.rev |
logical, if |
yaxis.range |
set the range of the y-axis. See Details. |
xaxis.log |
logical, if |
xaxis.range |
set the range of the x-axis. See Details. |
ylabels |
set up y-axis labels. See |
xlabels |
set up x-axis labels. See |
xtitle |
the x-axis title (also called x-axis caption). |
ytitle |
the y-axis title (also called y-axis caption). |
caption |
the figure caption. |
margin |
set the plot area margins, in units of lines of text. Generally
all NA or the output from |
... |
additional arguments for specific methods. |
xlabels.rotate |
logical, if |
Setting ylabels
or xlabels
to 0 or negtive values will
suppress ticks and labels. If negative, then try to create that absolute value
number of labels. That can be useful for relative axes or specialized labeling.
For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted—for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.
Information about the graph
Create a line or scatter plot from numeric x and y data.
Create a vertical dot plot. Also useful for setting up a bar chart for discrete x-axis values.
Create a vertical dot plot. Also useful for setting up a bar chart for discrete x-axis values.
A call should be made to setPage
to set up the graphics
environment before calling xyPlot
.
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y, Plot=list(color="cyan4")) # For more details of xyPlot see vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)
## Not run: set.seed(1) X <- rnorm(32) Y <- X + rnorm(32) setGD() AA.pl <- xyPlot(X, Y, Plot=list(color="cyan4")) # For more details of xyPlot see vignette(topic="GraphAdditions", package="smwrGraphs") vignette(topic="GraphGallery", package="smwrGraphs") vignette(topic="GraphSetup", package="smwrGraphs") vignette(topic="LineScatter", package="smwrGraphs") demo(topic="Coplot-complexScatterPlot", package="smwrGraphs") demo(topic="TopAxisExample", package="smwrGraphs") ## End(Not run)