histGram: Histogram

View source: R/histGram.R

histGramR Documentation

Histogram

Description

Creates either a frequency or density histogram.

Usage

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), ...)

Arguments

x

a numeric vector to create the histogram

breaks

any valid value for hist. See Details.

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 setGraph if appropriate.

...

additional arguments for other methods.

Details

To set the x-axis range, you must specify numeric breaks that span the complete range of x.

The components of Hist:

type

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.

fill

Logical value, TRUE means each bin will be shaded with fill.color.

boundary

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.

line.color

The color of the lines around the bins.

fill.color

The color the bins.

Value

Information about the graph.

Note

A call should be made to setPage to set up the graphics environment before calling histGram.

References

#'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.

See Also

ecdfPlot

Examples

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

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