flash_plot_bar | R Documentation |
Creates a bar plot or sequence of bar plots, one for each value of k
in
kset
, with bars corresponding to individual 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
).
This type of plot is most useful when rows i = 1, \ldots, n
or columns
j = 1, \ldots, p
are small in number or ordered in a logical fashion
(e.g., spatially).
flash_plot_bar(
fl,
order_by_pve = FALSE,
kset = NULL,
pm_which = c("factors", "loadings"),
pm_subset = NULL,
pm_groups = NULL,
pm_colors = NULL,
labels = FALSE,
...
)
fl |
An object inheriting from class |
order_by_pve |
If |
kset |
A vector of integers specifying the factor/loadings pairs to be
plotted. If |
pm_which |
Whether to plot loadings |
pm_subset |
A vector of row indices |
pm_groups |
A vector specifying the group to which each row of the data
|
pm_colors |
A character vector specifying a color for each unique group
specified by |
labels |
Whether to label the bars along the |
... |
Additional arguments to be passed to
|
When there is more than one value of k
in kset
, a sequence of
panels is created using the facet_wrap
function from
the ggplot2
package. In each panel, the order of bars is determined
by the order of the corresponding rows or columns in the data matrix;
they can be re-arranged using the pm_subset
argument.
A ggplot
object.
data(gtex)
fl <- flash(gtex, greedy_Kmax = 4L, backfit = FALSE)
flash_plot_bar(fl, pm_colors = gtex_colors)
# Tweaks are often required to get x-axis labels to look good:
library(ggplot2)
flash_plot_bar(fl, pm_colors = gtex_colors, labels = TRUE, ncol = 1) +
theme(axis.text.x = element_text(size = 8, angle = 60))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.