addArea: Add a Filled Polygon to Graph

View source: R/addArea.R

addAreaR Documentation

Add a Filled Polygon to Graph

Description

Adds a filled polygon (area) to a graph.

Usage

addArea(x, y, ybase = NULL, Area = list(name = "", color = "gray",
  outline = "black"), current = list(yaxis.log = FALSE, yaxis.rev =
  FALSE, xaxis.log = FALSE))

Arguments

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 areaPlot for details.

current

the current plot information. Typically, this would be the output from one of the graph creation functions like xyPlot.

Details

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.

Value

The current plot information is returned invisibly.

See Also

areaPlot, addXY, xyPlot

Examples

## 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)

USGS-R/smwrGraphs documentation built on Oct. 11, 2022, 6:11 a.m.