biPlot.princomp: Biplot

View source: R/biPlot.princomp.R

biPlot.princompR Documentation

Biplot

Description

Produces a biplot, which is a plot of two different types of data on the same graph, from a principal component analysis.

Usage

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

Arguments

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 setPlot for a description of the parameters.

varPlot

control information to plot the variables. See setPlot for a description of the parameters. For yPlot, symbol can be "arrow" to indicate that an arrow is to be drawn from the origin.

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

...

not used, required for other methods.

Details

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:

labels

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.

dir

the direction the label text is placed from the object.

size

the size of the label text.

offset

the distance the labels is placed relative to the object.

color

the color of the label text.

Value

Information about the graph.

Note

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

References

Gower, J.C. and Hand, D.J., 1996, Biplots, Chapman and Hall, London, 277 p.

See Also

setPage, biPlot

Examples

## Not run: 
# See for examples of biPlot:
vignette(topic="GraphGallery", package="smwrGraphs")

## End(Not run)

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