Draws a boxplot of feature abundances in each group. A separate plot is drawn and saved for each feature.
Usage
save_group_boxplots(
object,
all_features = FALSE,
save = TRUE,
file_path = NULL,
format = "emf",
x,
color,
title = "Feature_ID",
subtitle = NULL,
color_scale = getOption("notame.color_scale_dis"),
text_base_size = 14,
box_width = 0.8,
line_width = 0.5,
point_size = 3,
title_line_length = 40,
theme = theme_bw(base_size = text_base_size),
assay.type = NULL,
...
)
Arguments
- object
a
SummarizedExperiment
orMetaboSet
object- all_features
logical, should all features be used? If FALSE (the default), flagged features are removed before visualization.
- save
logical, if false, the plots are not saved but returned as a list
- file_path
character, a file path for PDF or prefix added to the file paths for other formats
- format
character, format in which the plots should be saved
- x
character, name of the column to be used as x-axis
- color
character, name of the column to be used for coloring
- title, subtitle
column names from feature data to use as plot title/filename and subtitle. Set to NULL for no title/subtitle, this creates running numbered filenames
- color_scale
the color scale as returned by a ggplot function
- text_base_size
integer, base size for text in figures
- box_width
numeric, width of the boxes
- line_width
numeric, width of the lines
- point_size
numeric, size of the mean points
- title_line_length
integer, maximum length of the title line in characters, passed to
str_wrap
- theme
a ggplot theme to be added to the plot
- assay.type
character, assay to be used in case of multiple assays
- ...
other arguments to graphic device functions, like width and height
Value
By default, the function is invoked for its plot-saving side effect.
The function returns a list of plots when save = FALSE
.
Examples
data(example_set)
# Default boxplots by group
save_group_boxplots(drop_qcs(example_set)[1:10],
file_path = "./group_boxplots.pdf",
format = "pdf", x = "Group", color = "Group"
)
#> INFO [2025-06-23 22:38:20] Saved group boxplots to: ./group_boxplots.pdf
# x and color can be a different variable
save_group_boxplots(drop_qcs(example_set)[1:10],
file_path = "./time_boxplots/",
format = "emf",
x = "Time",
color = "Group"
)
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:20] Saved to: ./time_boxplots/HILIC_neg_259_9623a4_4322.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:21] Saved to: ./time_boxplots/HILIC_neg_108_1065a2_6121.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:21] Saved to: ./time_boxplots/HILIC_neg_158_23a1_4128.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:21] Saved to: ./time_boxplots/HILIC_neg_251_0056a0_6161.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:21] Saved to: ./time_boxplots/HILIC_neg_401_52a4_211.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:21] Saved to: ./time_boxplots/HILIC_neg_400_7045a5_3842.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:21] Saved to: ./time_boxplots/HILIC_neg_304_014a7_1311.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:22] Saved to: ./time_boxplots/HILIC_neg_276_6328a2_7734.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:22] Saved to: ./time_boxplots/HILIC_neg_118_9111a4_1865.emf
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> Warning: devEMF: your system substituted font family 'Nimbus Sans' when you requested 'Helvetica'
#> INFO [2025-06-23 22:38:22] Saved to: ./time_boxplots/HILIC_neg_446_9413a2_315.emf
#> INFO [2025-06-23 22:38:22] Saved group boxplots to: ./time_boxplots/
# Plot one feature
save_group_boxplots(drop_qcs(example_set)[1, ], save = FALSE, x = "Group",
color = "Group")
#> Just a remainder, creating a long list of plots takes a lot of memory!
#> [[1]]
#>