Package 'aplotExtra'

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] (ORCID: <https://orcid.org/0000-0002-6485-8781>), Shuangbin Xu [ctb] (ORCID: <https://orcid.org/0000-0003-3513-5362>), Chun-Hui Gao [ctb] (ORCID: <https://orcid.org/0000-0002-1445-7939>), Shensuo Li [ctb] (ORCID: <https://orcid.org/0009-0006-3229-3700>)
Maintainer: Guangchuang Yu <[email protected]>
License: Artistic-2.0
Version: 0.0.5.001
Built: 2026-07-15 04:39:27 UTC
Source: https://github.com/yulab-smu/aplotextra

Help Index


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)

Get reusable oncoplot components

Description

Build the reusable panels and tidy data used by oncoplot(). This function is intended for downstream packages that want to assemble an oncoplot with additional tracks while reusing the aplotExtra mutation matrix, sample burden, gene burden, and mutation color mapping.

Usage

oncoplot_components(maf, genes = 20)

Arguments

maf

A MAF object.

genes

The gene names or number of top mutated genes.

Value

A list with components:

data

Tidy oncoplot matrix.

main

Main mutation tile plot.

sample

Sample-level top annotation plot.

gene

Gene-level side annotation plot.

colors

Named mutation-class color vector.


upset_plot

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)