Title: Creating Composite Plots using 'aplot'
Version: 0.0.4
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.
Depends: R (≥ 4.1.0)
Imports: aplot (≥ 0.2.3), dplyr, forcats, ggfun (≥ 0.1.1), ggplot2, grid, maftools, purrr, rlang, stats, tibble, tidyr, utils, ggstar, yulab.utils (≥ 0.0.8)
Suggests: ggtree, data.table, RColorBrewer, R.utils
URL: https://github.com/YuLab-SMU/aplotExtra
License: Artistic-2.0
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-06-12 02:36:09 UTC; HUAWEI
Author: Guangchuang Yu ORCID iD [aut, cre], Shuangbin Xu ORCID iD [ctb], Chun-Hui Gao ORCID iD [ctb], Shensuo Li ORCID iD [ctb]
Maintainer: Guangchuang Yu <guangchuangyu@gmail.com>
Repository: CRAN
Date/Publication: 2025-06-12 04:20:02 UTC

aplotExtra: 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.

Author(s)

Maintainer: Guangchuang Yu guangchuangyu@gmail.com (ORCID)

Other contributors:

See Also

Useful links:


funky_bar

Description

create bar plot for funkyheatmap

Usage

funky_bar(data, cols)

Arguments

data

data frame

cols

selected columns

Value

ggplot object

Author(s)

Guangchuang Yu


funky_heatmap

Description

create a funkyheatmap

Usage

funky_heatmap(..., data = NULL, widths = NULL, options = NULL)

Arguments

...

funky plots (e.g., outputs of funky_point, funky_bar, etc.)

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

Value

gglist object

Author(s)

Guangchuang Yu


funky_point

Description

create dot plot for funkyheatmap

Usage

funky_point(data, cols, cols2 = NULL, ...)

Arguments

data

data frame

cols

selected columns

cols2

selected columns to keep names

...

additional parameters, passing to geom_star

Value

ggplot object

Author(s)

Guangchuang Yu


funky_text

Description

create text plot (i.e., rownames) for funkyheatmap

Usage

funky_text(data, cols = 1, hjust = 0)

Arguments

data

data frame

cols

selected column

hjust

text alignment adjustment

Value

ggplot object

Author(s)

Guangchuang Yu


Get the items/names/ids of subsets from a named list

Description

Get the items/names/ids of subsets from a named list

Usage

get_all_subsets(list, name_separator = "/")

Arguments

list

a named list

name_separator

default is /

Value

a tibble

Examples

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

Description

ploting oncoplot with aplot

Usage

oncoplot(maf, genes = 20)

Arguments

maf

MAF object.

genes

the gene names or the number, default is 20.

Value

oncoplot object, which is also a aplot object

Examples


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)


upsetplot2

Description

Plot a upset plot

Usage

upset_plot(
  list,
  nintersects = NULL,
  order.intersect.by = c("size", "name"),
  order.set.by = c("size", "name"),
  color.intersect.by = "none",
  color.set.by = "none",
  remove_empty_intersects = TRUE
)

Arguments

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'

color.intersect.by

color scheme for 'intersect' bars (e.g., "Set2"), default is "none"

color.set.by

color scheme for 'set' bars (e.g., "Set3"), default is "none"

remove_empty_intersects

remove the intersects which have zero elements. Default is TRUE.

Details

This function generate a upset plot by creating a composite plot which contains subplots generated by ggplot2.

Value

an upset plot

Examples

 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, remove_empty_intersects = TRUE)
 upset_plot(list, order.intersect.by = "name")
 upset_plot(list, order.set.by = "name")
 upset_plot(list, nintersects = 6)