File: background_grid.Rd

package info (click to toggle)
r-cran-cowplot 1.1.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,564 kB
  • sloc: sh: 13; makefile: 5
file content (49 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/themes.R
\name{background_grid}
\alias{background_grid}
\title{Add/modify/remove the background grid in a ggplot2 plot}
\usage{
background_grid(
  major = c("xy", "x", "y", "only_minor", "none"),
  minor = c("none", "xy", "x", "y"),
  size.major = 0.5,
  size.minor = 0.2,
  color.major = "grey85",
  color.minor = "grey85",
  colour.major,
  colour.minor
)
}
\arguments{
\item{major}{Specifies along which axes you would like to plot major grid lines. Options are "xy", "x",
"y", "none".}

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

\item{size.major}{Size of the major grid lines.}

\item{size.minor}{Size of the minor grid lines.}

\item{color.major, colour.major}{Color of the major grid lines.}

\item{color.minor, colour.minor}{Color of the minor grid lines.}
}
\description{
This function provides a simple way to set the background grid in ggplot2. It
doesn't do anything that can't be done just the same with \code{\link[=theme]{theme()}}. However, it simplifies
creation of the most commonly needed variations.
}
\details{
Note: This function completely overwrites all background grid settings of the current theme. If that
is not what you want, you may be better off using \code{\link[=theme]{theme()}} directly.
}
\examples{
library(ggplot2)

ggplot(iris, aes(Sepal.Length, Sepal.Width)) +
 geom_point() +
 theme_half_open() +
 background_grid()
}