View source: R/utility_functions.R
extract_syndromic_plot | R Documentation |
Extract the syndromic plot of a given list of loadings and specified pc.
extract_syndromic_plot( load_df, pc, cutoff = 0.5, VAF, arrow_size_multi = 10, repel = F, plot_legend = TRUE, plot_cutoff = TRUE, text_size = 6, var_order = "abs decreasing", colors = c("steelblue1", "white", "firebrick1") )
load_df |
data.frame with the loadings. Format: one column named Variable and a column for each PC. It can be extracted from a prcomp or princals object using stand_loadings(). |
pc |
String. Name of the PC in load_df to plot. |
cutoff |
Numeric. Value of the loadings threshold (i.e. |loadings| > cutoff) to plot. Default = 0.5 |
VAF |
String. Text for the center of the syndromic plot. The text generally corresponds to the variance accounted for (VAF) of the PC. If pca is the results of prcomp or princals, VAF is internally calculated. |
arrow_size_multi |
Numeric. Controls the size of the arrows proportional to the loading. Default=10 |
repel |
Logical. Whether to repel the text for preventing text overlap. Default=FALSE |
plot_legend |
Logical. Whether to plot the legend or not. Default=TRUE |
plot_cutoff |
Logical. Whether to report the cutoff on the legend or not. Default = TRUE |
text_size |
Numeric. Controls for the size of the text. Default=9. |
var_order |
Character, character vector or numeric vector. Specify the order of the variables in the plot by the loading values, starting at 12 o’clock and moving counterclockwise. Possible values: 'abs decreasing': plot by decreasing absolute value; 'abs increasing': plot by increasing absolute value; 'decreasing'; or 'increasing’. A vector can be specified with a custom order of the variables to plot. If a numeric vector is provided, the variables will be ordered as specified by the numbers. If a character vector is provided, the variables will be ordered in the same order as the variable names provided. In case of vector, non-specified variables will be excluded from the plot. |
colors |
Character vector of length 3. Vector with the character name or hexadecimal number (e.g. "#FF0000") of three colors, the lower color, the middle color and the higher color for the gradient used in the plot. Hexadecimal number can be obtained using rgb for example. |
A ggplot2 object of the syndromic plot.
Abel Torres Espin
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.