Learn R Programming

GGally (version 1.3.2)

+.gg: Modify a ggmatrix object by adding an ggplot2 object to all plots

Description

This operator allows you to add ggplot2 objects to a ggmatrix object.

Usage

# S3 method for gg
+(e1, e2)

Arguments

e1

An object of class ggplot or theme

e2

A component to add to e1

Details

If the first object is an object of class ggmatrix, you can add the following types of objects, and it will return a modified ggplot object.

  • theme: update plot theme

The + operator completely replaces elements with elements from e2.

See Also

+.gg and theme

Examples

Run this code
# NOT RUN {
data(tips, package = "reshape")
pm <- ggpairs(tips[, 2:3])
## change to black and white theme
pm + ggplot2::theme_bw()
## change to linedraw theme
# pm + ggplot2::theme_linedraw()
## change to custom theme
# pm + ggplot2::theme(panel.background = ggplot2::element_rect(fill = "lightblue"))
## add a list of information
extra <- list(ggplot2::theme_bw(), ggplot2::labs(caption = "My caption!"))
pm + extra
# }

Run the code above in your browser using DataLab