R: Modify a ggmatrix object by adding an ggplot2 object to all...
+.gg
R Documentation
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 class '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
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"))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GGally)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GGally/gg-add.Rd_%03d_medium.png", width=480, height=480)
> ### Name: +.gg
> ### Title: Modify a ggmatrix object by adding an ggplot2 object to all
> ### plots
> ### Aliases: +.gg
>
> ### ** Examples
>
> data(tips, package = "reshape")
> pm <- ggpairs(tips[, 2:3])
> ## change to black and white theme
> pm + ggplot2::theme_bw()
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
> ## change to linedraw theme
> # pm + ggplot2::theme_linedraw()
> ## change to custom theme
> # pm + ggplot2::theme(panel.background = ggplot2::element_rect(fill = "lightblue"))
>
>
>
>
>
>
> dev.off()
null device
1
>