Easily remove any gridlines from a ggplot.

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)

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.

Value

a theme object which can be used in ggplot2 calls

Author

Thomas Neitmann

Examples

library(ggplot2)
p <- ggplot(mtcars, aes(hp, mpg)) +
  geom_point()

# 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()