Learn R Programming

ggplot2bdc (version 0.3.2)

gg_remove_grid: Remove grid lines from a plot

Description

gg_remove_grid removes either the major or minor grid lines on either axis. gg_remove_grid_major Removes grid lines at major breaks gg_remove_grid_minor Removes grid lines at minor breaks gg_remove_grid_x Removes grid lines at major and minor breaks on the X axis gg_remove_grid_y Removes grid lines at major and minor breaks on the X axis

Usage

gg_remove_grid(plot = last_plot(), major.x = TRUE, major.y = TRUE,
  minor.x = TRUE, minor.y = TRUE)

gg_remove_grid_major(plot = last_plot(), major.x = TRUE, major.y = TRUE)

gg_remove_grid_minor(plot = last_plot(), minor.x = TRUE, minor.y = TRUE)

gg_remove_grid_x(plot = last_plot(), major = TRUE, minor = TRUE)

gg_remove_grid_y(plot = last_plot(), major = TRUE, minor = TRUE)

Arguments

plot
A ggplot2 plot object. By default, the last plot displayed is used.
major.x
Whether or not to remove grid lines at major breakpoints along the X axis (default: TRUE)
major.y
Whether or not to remove grid lines at major breakpoints along the Y axis (default: TRUE)
minor.x
Whether or not to remove grid lines at minor breakpoints along the X axis (default: TRUE)
minor.y
Whether or not to remove grid lines at minor breakpoints along the Y axis (default: TRUE)

Value

A modified ggplot2 plot

Examples

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

Run the code above in your browser using DataLab