Learn R Programming

ggeasy (version 0.1.4)

easy_remove_gridlines: Easily remove gridlines

Description

Easily remove any gridlines from a ggplot.

Usage

easy_remove_gridlines(
  axis = c("both", "x", "y"),
  minor = TRUE,
  major = TRUE,
  teach = FALSE
)

easy_remove_x_gridlines(minor = TRUE, major = TRUE, teach = FALSE)

easy_remove_y_gridlines(minor = TRUE, major = TRUE, teach = FALSE)

Value

a theme object which can be used in ggplot2 calls

Arguments

axis

From which axis should grid lines be removed? By default "both".

minor

Should minor grid lines be removed? By default TRUE.

major

Should major grid lines be removed? By default TRUE.

teach

Should the equivalent ggplot2 expression be printed? By default FALSE.

Author

Thomas Neitmann

Examples

Run this code
library(ggplot2)
p <- ggplot(mtcars, aes(hp, mpg))

# remove all grid lines at once
p + easy_remove_gridlines()

# remove all minor grid lines
p + easy_remove_gridlines(major = FALSE)

# remove all major grid lines
p + easy_remove_gridlines(minor = FALSE)

# remove x gridlines
p + easy_remove_x_gridlines()
# or
p + easy_remove_gridlines(axis = "x")

# remove y gridlines
p + easy_remove_y_gridlines()

Run the code above in your browser using DataLab