Title: | Creating Composite Plots using 'aplot' |
---|---|
Description: | Many complex plots are actually composite plots, such as 'oncoplot', 'funkyheatmap', 'upsetplot', etc. We can produce subplots using 'ggplot2' and combine them to create composite plots using 'aplot'. In this way, it is easy to customize these complex plots, by adding, deleting or modifying subplots in the final plot. This package provides a set of utilities to help users to create subplots and complex plots. |
Authors: | Guangchuang Yu [aut, cre] , Shuangbin Xu [ctb] , Chun-Hui Gao [ctb] , Shensuo Li [ctb] |
Maintainer: | Guangchuang Yu <[email protected]> |
License: | Artistic-2.0 |
Version: | 0.0.2.001 |
Built: | 2024-10-31 18:37:59 UTC |
Source: | https://github.com/yulab-smu/aplotextra |
create bar plot for funkyheatmap
funky_bar(data, cols)
funky_bar(data, cols)
data |
data frame |
cols |
selected columns |
ggplot object
Guangchuang Yu
create a funkyheatmap
funky_heatmap(..., data = NULL, widths = NULL, options = NULL)
funky_heatmap(..., data = NULL, widths = NULL, options = NULL)
... |
funky plots (e.g., outputs of |
data |
If data is provided, create a funkyheatmap from it. Otherwise, create composite plot from |
widths |
relative widths of the plots |
options |
any ggplot component that can be added to the plots |
gglist object
Guangchuang Yu
create dot plot for funkyheatmap
funky_point(data, cols, cols2 = NULL, ...)
funky_point(data, cols, cols2 = NULL, ...)
data |
data frame |
cols |
selected columns |
cols2 |
selected columns to keep names |
... |
additional parameters, passing to |
ggplot object
Guangchuang Yu
create text plot (i.e., rownames) for funkyheatmap
funky_text(data, cols = 1, hjust = 0)
funky_text(data, cols = 1, hjust = 0)
data |
data frame |
cols |
selected column |
hjust |
text alignment adjustment |
ggplot object
Guangchuang Yu
Get the items/names/ids of subsets from a named list
get_all_subsets(list, name_separator = "/")
get_all_subsets(list, name_separator = "/")
list |
a named list |
name_separator |
default is / |
a tibble
list = list(A = sample(LETTERS, 20), B = sample(LETTERS, 22), C = sample(LETTERS, 24), D = sample(LETTERS, 30, replace = TRUE)) get_all_subsets(list)
list = list(A = sample(LETTERS, 20), B = sample(LETTERS, 22), C = sample(LETTERS, 24), D = sample(LETTERS, 30, replace = TRUE)) get_all_subsets(list)
ploting oncoplot with aplot
oncoplot(maf, genes = 20)
oncoplot(maf, genes = 20)
maf |
MAF object. |
genes |
the gene names or the number, default is 20. |
oncoplot
object, which is also a aplot
object
laml.maf <- system.file("extdata", "tcga_laml.maf.gz", package = "maftools") laml.clin <- system.file('extdata', 'tcga_laml_annot.tsv', package = 'maftools') laml <- maftools::read.maf(maf = laml.maf, clinicalData = laml.clin) oncoplot(maf = laml, genes = 20)
laml.maf <- system.file("extdata", "tcga_laml.maf.gz", package = "maftools") laml.clin <- system.file('extdata', 'tcga_laml_annot.tsv', package = 'maftools') laml <- maftools::read.maf(maf = laml.maf, clinicalData = laml.clin) oncoplot(maf = laml, genes = 20)
Plot a upset plot
upset_plot( list, nintersects = NULL, order.intersect.by = c("size", "name"), order.set.by = c("size", "name") )
upset_plot( list, nintersects = NULL, order.intersect.by = c("size", "name"), order.set.by = c("size", "name") )
list |
a list of sets |
nintersects |
number of intersects. If NULL, all intersections will show. |
order.intersect.by |
one of 'size' or 'name' |
order.set.by |
one of 'size' or 'name' |
This function generate a upset plot by creating a composite plot which contains subplots generated by ggplot2.
an upset plot
list = list(A = sample(LETTERS, 20), B = sample(LETTERS, 22), C = sample(LETTERS, 14), D = sample(LETTERS, 30, replace = TRUE)) upset_plot(list) upset_plot(list, order.intersect.by = "name") upset_plot(list, nintersects = 6)
list = list(A = sample(LETTERS, 20), B = sample(LETTERS, 22), C = sample(LETTERS, 14), D = sample(LETTERS, 30, replace = TRUE)) upset_plot(list) upset_plot(list, order.intersect.by = "name") upset_plot(list, nintersects = 6)