stat_rows {ordr} | R Documentation |
Render plot elements for one matrix of an ordination
Description
These stats merely tell ggplot2::ggplot()
which factor of an
ordination to pull data from for a plot layer. They are invoked internally
by the various geom_*_*()
layers.
Usage
stat_rows(
mapping = NULL,
data = data,
geom = "point",
position = "identity",
subset = NULL,
elements = "all",
...,
show.legend = NA,
inherit.aes = TRUE
)
stat_cols(
mapping = NULL,
data = data,
geom = "axis",
position = "identity",
subset = NULL,
elements = "all",
...,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
The geometric object to use to display the data, either as a
|
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
subset |
An integer, logical, or character vector indicating a subset of
rows or columns for which to render graphical elements. NB: Internally, the
|
elements |
Character vector; which elements of each factor for which to
render graphical elements. One of |
... |
Additional arguments passed to |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Value
A ggproto layer.
Biplot layers
ggbiplot()
uses ggplot2::fortify()
internally to produce a single data
frame with a .matrix
column distinguishing the subjects ("rows"
) and
variables ("cols"
). The stat layers stat_rows()
and stat_cols()
simply
filter the data frame to one of these two.
The geom layers geom_rows_*()
and geom_cols_*()
call the corresponding
stat in order to render plot elements for the corresponding factor matrix.
geom_dims_*()
selects a default matrix based on common practice, e.g.
points for rows and arrows for columns.
See Also
Other biplot layers:
biplot-geoms
,
biplot-stats
Examples
# FA of Swiss social data
swiss_fa <-
ordinate(swiss, model = factanal, factors = 2L, scores = "regression")
# active and supplementary elements
get_rows(swiss_fa, elements = "active")
head(get_rows(swiss_fa, elements = "score"))
# biplot using element filters and selection
# (note that filter precedes selection)
ggbiplot(swiss_fa) +
geom_rows_point(elements = "score") +
geom_rows_text(aes(label = name), elements = "score", subset = c(1, 4, 18)) +
scale_alpha_manual(values = c(0, 1), guide = "none") +
geom_cols_vector() +
geom_cols_text_radiate(aes(label = name))