flash_plot_scatter | R Documentation |
Creates a scatter plot or sequence of scatter plots, with position along the
x
-axis defined by posterior means for factors f_{jk}
or loadings
\ell_{ik}
and position along the y
-axis defined by a
user-supplied covariate. If a covariate is not supplied, then plots will
use data column or row means, \frac{1}{n} \sum_{i = 1}^n y_{ij}
or
\frac{1}{p} \sum_{j = 1}^p y_{ij}
. One plot is created for
each value of k
in kset
. 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_scatter(
fl,
order_by_pve = FALSE,
kset = NULL,
pm_which = c("factors", "loadings"),
pm_subset = NULL,
pm_groups = NULL,
pm_colors = NULL,
covariate = NULL,
shape = 1,
labels = FALSE,
n_labels = 0,
label_size = 3,
max_overlaps = Inf,
...
)
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 |
covariate |
A numeric vector with one value for each plotted row |
shape |
The symbol used for the plots' points. See
|
labels |
Whether to label the points with the largest (absolute)
posterior means. If |
n_labels |
A (nonnegative) integer. The number of points to label. If
|
label_size |
The size of the label text (in millimeters). |
max_overlaps |
A (nonnegative) integer. For each text label, the number of overlaps with other text labels or other data points are counted, and the text label is excluded if it has too many overlaps. |
... |
Additional arguments to be passed to
|
A ggplot
object.
data(gtex)
fl <- flash(gtex, greedy_Kmax = 4L, backfit = FALSE)
flash_plot_scatter(fl)
# Label axes and points:
library(ggplot2)
flash_plot_scatter(fl, labels = TRUE, n_labels = 3) +
labs(y = "mean z-score across all SNPs")
# For the full range of labelling options provided by the ggrepel package, set
# labels = FALSE (the default setting) and add geom_text_repel() manually:
library(ggrepel)
flash_plot_scatter(fl, labels = FALSE, n_labels = 3) +
geom_text_repel(size = 2.5, min.segment.length = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.