Learn R Programming

cowplot (version 0.9.2)

background_grid: Add/modify/remove the background grid in a ggplot2 plot

Description

This function provides a simple way to modify the background grid in ggplot2. It doesn't do anything that can't be done just the same with theme(). However, it simplifies creation of the most commonly needed variations.

Usage

background_grid(major = c("xy", "x", "y", "only_minor", "none"),
  minor = c("xy", "x", "y", "none"), size.major = 0.2, size.minor = 0.5,
  colour.major = "grey90", colour.minor = "grey98")

Arguments

major

Specifies along which axes you would like to plot major grid lines. Options are "xy", "x", "y", "only_minor" (disables major grid lines but allows you to switch on minor grid lines), "none".

minor

Specifies along which axes you would like to plot minor grid lines. Options are "xy", "x", "y", "none".

size.major

Size of the major grid lines.

size.minor

Size of the minor grid lines.

colour.major

Color of the major grid lines.

colour.minor

Color of the minor grid lines.