biplot2d {OpenRepGrid} | R Documentation |
Draw a two-dimensional biplot.
Description
The biplot is the central way to create a joint plot of elements and constructs. Depending on the parameters chosen it contains information on the distances between elements and constructs. Also the relative values the elements have on a construct can be read off by projection the element onto the construct vector. A lot of parameters can be changed rendering different types of biplots (ESA, Slater's) and different looks (colors, text size). See the example section below to get started.
Usage
biplot2d(
x,
dim = c(1, 2),
map.dim = 3,
center = 1,
normalize = 0,
g = 0,
h = 1 - g,
col.active = NA,
col.passive = NA,
e.point.col = "black",
e.point.cex = 0.9,
e.label.col = "black",
e.label.cex = 0.7,
e.color.map = c(0.4, 1),
c.point.col = "black",
c.point.cex = 0,
c.label.col = "black",
c.label.cex = 0.7,
c.color.map = c(0.4, 1),
c.points.devangle = 91,
c.labels.devangle = 91,
c.points.show = TRUE,
c.labels.show = TRUE,
e.points.show = TRUE,
e.labels.show = TRUE,
inner.positioning = TRUE,
outer.positioning = TRUE,
c.labels.inside = FALSE,
c.lines = TRUE,
col.c.lines = grey(0.9),
flipaxes = c(FALSE, FALSE),
strokes.x = 0.1,
strokes.y = 0.1,
offsetting = TRUE,
offset.labels = 0,
offset.e = 1,
axis.ext = 0.1,
mai = c(0.2, 1.5, 0.2, 1.5),
rect.margins = c(0.01, 0.01),
srt = 45,
cex.pos = 0.7,
xpd = TRUE,
unity = FALSE,
unity3d = FALSE,
scale.e = 0.9,
zoom = 1,
var.show = TRUE,
var.cex = 0.7,
var.col = grey(0.1),
...
)
Arguments
x |
|
dim |
Dimensions (i.e. principal components) to be used for biplot
(default is |
map.dim |
Third dimension (depth) used to map aesthetic attributes to
(default is |
center |
Numeric. The type of centering to be performed.
0= no centering, 1= row mean centering (construct),
2= column mean centering (elements), 3= double-centering (construct and element means),
4= midpoint centering of rows (constructs).
The default is |
normalize |
A numeric value indicating along what direction (rows, columns)
to normalize by standard deviations. |
g |
Power of the singular value matrix assigned to the left singular vectors, i.e. the constructs. |
h |
Power of the singular value matrix assigned to the right singular vectors, i.e. the elements. |
col.active |
Columns (elements) that are no supplementary points, i.e. they are used in the SVD to find principal components. default is to use all elements. |
col.passive |
Columns (elements) that are supplementary points, i.e. they are NOT used
in the SVD but projected into the component space afterwards. They do not
determine the solution. Default is |
e.point.col |
Color of the element symbols. The default is |
e.point.cex |
Size of the element symbols. The default is |
e.label.col |
Color of the element label. The default is |
e.label.cex |
Size of the element labels. The default is |
e.color.map |
Value range to determine what range of the color ramp defined in
|
c.point.col |
Color of the construct symbols. The default is |
c.point.cex |
Size of the construct symbols. The default is |
c.label.col |
Color of the construct label. The default is |
c.label.cex |
Size of the construct labels. The default is |
c.color.map |
Value range to determine what range of the color ramp defined in
|
c.points.devangle |
The deviation angle from the x-y plane in degrees. These can only be calculated
if a third dimension |
c.labels.devangle |
The deviation angle from the x-y plane in degrees. These can only be calculated
if a third dimension |
c.points.show |
Whether the constructs are printed (default is |
c.labels.show |
Whether the construct labels are printed (default is |
e.points.show |
Whether the elements are printed (default is |
e.labels.show |
Whether the element labels are printed (default is |
inner.positioning |
Logical. Whether to calculate positions to minimize overplotting of
elements and construct labels (default is |
outer.positioning |
Logical. Whether to calculate positions to minimize overplotting of
of construct labels on the outer borders (default is |
c.labels.inside |
Logical. Whether to print construct labels next to the points.
Can be useful during inspection of the plot (default |
c.lines |
Logical. Whether construct lines from the center of the biplot
to the surrounding box are drawn (default is |
col.c.lines |
The color of the construct lines from the center to the borders
of the plot (default is |
flipaxes |
Logical vector of length two. Whether x and y axes are reversed
(default is |
strokes.x |
Length of outer strokes in x direction in NDC. |
strokes.y |
Length of outer strokes in y direction in NDC. |
offsetting |
Do offsetting? (TODO) |
offset.labels |
Offsetting parameter for labels (TODO). |
offset.e |
offsetting parameter for elements (TODO). |
axis.ext |
Axis extension factor (default is |
mai |
Margins available for plotting the labels in inch
(default is |
rect.margins |
Vector of length two (default is |
srt |
Angle to rotate construct label text. Only used in case |
cex.pos |
Cex parameter used during positioning of labels if prompted. Does usually not have to be changed by user. |
xpd |
Logical (default is |
unity |
Scale elements and constructs coordinates to unit scale in 2D (maximum of 1)
so they are printed more neatly (default |
unity3d |
Scale elements and constructs coordinates to unit scale in 3D (maximum of 1)
so they are printed more neatly (default |
scale.e |
Scaling factor for element vectors. Will cause element points to move a bit more
to the center. (but only if |
zoom |
Scaling factor for all vectors. Can be used to zoom
the plot in and out (default |
var.show |
Show explained sum-of-squares in biplot? (default |
var.cex |
The cex value for the percentages shown in the plot. |
var.col |
The color value of the percentages shown in the plot. |
... |
parameters passed on to come. |
Details
For the construction of a biplot the grid matrix is first centered and normalized according to the prompted options.
Next, the matrix is decomposed by singular value decomposition (SVD) into
X = UDV^T
The biplot is made up of two matrices
X = GH^T
These matrices are construed on the basis of the SVD results.
\hat{X} = UD^gD^hV^T
Note that the grid matrix values are only recovered and
the projection property is only given if g + h = 1
See Also
Unsophisticated biplot:
biplotSimple()
;2D biplots:
biplot2d()
,biplotEsa2d()
,biplotSlater2d()
;Pseudo 3D biplots:
biplotPseudo3d()
,biplotEsaPseudo3d()
,biplotSlaterPseudo3d()
;Interactive 3D biplots:
biplot3d()
,biplotEsa3d()
,biplotSlater3d()
;Function to set view in 3D:
home()
Examples
## Not run:
biplot2d(boeker) # biplot of boeker data
biplot2d(boeker, c.lines = T) # add construct lines
biplot2d(boeker, center = 2) # with column centering
biplot2d(boeker, center = 4) # midpoint centering
biplot2d(boeker, normalize = 1) # normalization of constructs
biplot2d(boeker, dim = 2:3) # plot 2nd and 3rd dimension
biplot2d(boeker, dim = c(1, 4)) # plot 1st and 4th dimension
biplot2d(boeker, g = 1, h = 1) # assign singular values to con. & elem.
biplot2d(boeker, g = 1, h = 1, center = 1) # row centering (Slater)
biplot2d(boeker, g = 1, h = 1, center = 4) # midpoint centering (ESA)
biplot2d(boeker, e.color = "red", c.color = "blue") # change colors
biplot2d(boeker, c.color = c("white", "darkred")) # mapped onto color range
biplot2d(boeker, unity = T) # scale con. & elem. to equal length
biplot2d(boeker, unity = T, scale.e = .5) # scaling factor for element vectors
biplot2d(boeker, e.labels.show = F) # do not show element labels
biplot2d(boeker, e.labels.show = c(1, 2, 4)) # show labels for elements 1, 2 and 4
biplot2d(boeker, e.points.show = c(1, 2, 4)) # only show elements 1, 2 and 4
biplot2d(boeker, c.labels.show = c(1:4)) # show constructs labels 1 to 4
biplot2d(boeker, c.labels.show = c(1:4)) # show constructs labels except 1 to 4
biplot2d(boeker, e.cex.map = 1) # change size of texts for elements
biplot2d(boeker, c.cex.map = 1) # change size of texts for constructs
biplot2d(boeker, g = 1, h = 1, c.labels.inside = T) # constructs inside the plot
biplot2d(boeker,
g = 1, h = 1, c.labels.inside = T, # different margins and elem. color
mai = c(0, 0, 0, 0), e.color = "red"
)
biplot2d(boeker, strokes.x = .3, strokes.y = .05) # change length of strokes
biplot2d(boeker, flipaxes = c(T, F)) # flip x axis
biplot2d(boeker, flipaxes = c(T, T)) # flip x and y axis
biplot2d(boeker, outer.positioning = F) # no positioning of con.-labels
biplot2d(boeker, c.labels.devangle = 20) # only con. within 20 degree angle
## End(Not run)