Learn R Programming

ggplot2bdc (version 0.3.2)

gg_remove_background: Remove a plot's background.

Description

gg_remove_background removes the background from the given plot. This is useful for creating plots with transparent backgrounds gg_remove_background_canvas Removes TODO gg_remove_background_panel Removes TODO gg_remove_background_legend Removes TODO gg_remove_background_facet Removes TODO

Usage

gg_remove_background(plot = last_plot(), canvas = TRUE, panel = FALSE,
  legend = FALSE, facet = FALSE)

gg_remove_background_canvas(plot = last_plot())

gg_remove_background_panel(plot = last_plot())

gg_remove_background_legend(plot = last_plot())

gg_remove_background_facet(plot = last_plot())

Arguments

plot
A ggplot2 plot object. By default, the last plot displayed is used.
canvas
Whether or not to remove the background from the entire image (default: TRUE)
panel
Whether or not to remove the background from the panel (i.e., the plotting area; default: FALSE)
legend
Whether or not to remove the legend's background (default: FALSE)
facet
Whether or not to remove the background from facet labels (default: FALSE)

Value

A modified ggplot2 plot

Examples

Run this code
p <- ggplot(mtcars, aes(x = cyl, y = mpg)) +
    geom_point(shape = 1)
gg_remove_background(plot = p)

Run the code above in your browser using DataLab