stat_rows | R Documentation |
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.
stat_rows(
mapping = NULL,
data = data,
geom = "point",
position = "identity",
subset = NULL,
elements = "active",
...,
show.legend = NA,
inherit.aes = TRUE
)
stat_cols(
mapping = NULL,
data = data,
geom = "axis",
position = "identity",
subset = NULL,
elements = "active",
...,
show.legend = NA,
inherit.aes = TRUE
)
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 for this layer.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
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 |
A ggproto layer.
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.
Other biplot layers:
biplot-geoms
,
biplot-stats
,
stat_referent()
# 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_label(aes(label = name), elements = "score", subset = c(1, 4, 18)) +
scale_alpha_manual(values = c(0, 1), guide = "none") +
geom_cols_vector(aes(label = name))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.