Creates a heatmap of posterior means for factors \(f_{jk}\) or loadings
\(\ell_{ik}\). Values are normalized so that the maximum absolute value
for each factor \(f_{\cdot k}\) or set of loadings \(\ell_{\cdot k}\)
is equal to 1 (see ldf.flash
).
flash_plot_heatmap(
fl,
order_by_pve = FALSE,
kset = NULL,
pm_which = c("factors", "loadings"),
pm_subset = NULL,
pm_groups = NULL,
pm_colors = NULL,
gap = 1,
...
)
An object inheriting from class flash
.
If order_by_pve = TRUE
, then factor/loadings pairs
will be ordered according to proportion of variance explained, from
highest to lowest. (By default, they are plotted in the same order as
kset
; or, if kset
is NULL
, then they are plotted in
the same order as they are found in fl
.)
A vector of integers specifying the factor/loadings pairs to be
plotted. If order_by_pve = FALSE
, then kset
also specifies the
order in which they are to be plotted.
Whether to plot loadings \(L\) or factors \(F\).
A vector of row indices \(i\) or column indices
\(j\) (depending on the argument to pm_which
)
specifying which values \(\ell_{i \cdot}\) or \(f_{j \cdot}\) are
to be shown. If the dataset has row or column names, then names rather
than indices may be specified. If pm_subset = NULL
, then all values
will be plotted.
A vector specifying the group to which each row of the data
\(y_{i \cdot}\) or column \(y_{\cdot j}\) belongs (groups may be
numeric indices or strings). A group must be provided for each plotted row
\(i\) or column \(j\), so that the length of pm_groups
is
exactly equal to the number of rows or columns in the full dataset or, if
pm_subset
is specified, in the subsetted dataset.
A character vector of length 1, 2, or 3 defining the
diverging color gradient (low-mid-high) to be used by the heatmap. The
midpoint is set at zero. If one or two colors are supplied, then the
"mid" color will be set to white. If one color is supplied, then the "low"
and "high" colors (used for, respectively, negative and positive posterior
means) will be the same. If two are supplied, then the "low" color should
be provided first, followed by the "high" color. If all three are supplied,
then the "low" color should be provided first, followed by the "mid" color,
followed by the "high" color provided. The default color gradient is
darkblue
for "low" (negative posterior means), white for "mid"
(zero), and darkred
for "high" (positive posterior means).
The horizontal spacing between groups. Ignored if pm_groups
is not provided.
Additional parameters to be passed to
structure_plot
(which is primarily used to
arrange the rows \(i\) or columns \(j\)).
A ggplot
object.
By default, a 1-d embedding is used to arrange the rows \(i\) or columns
\(j\) in a "smart" manner. This behavior can be overridden via argument
loadings_order
, which is passed to function
structure_plot
.