easy_remove_axes: Easily remove one or more axes

View source: R/axis.R

easy_remove_axesR Documentation

Easily remove one or more axes

Description

easy_remove_axes by default removes both axes, but can remove only x or y if "x" or "y" is given to the 'which' argument

Usage

easy_remove_axes(
  which = c("both", "x", "y"),
  what = c("ticks", "title", "text", "line"),
  teach = FALSE
)

easy_remove_y_axis(what = c("ticks", "title", "text", "line"), teach = FALSE)

easy_remove_x_axis(what = c("ticks", "title", "text", "line"), teach = FALSE)

Arguments

which

which axis or axes to remove, by default "both"

what

axis components to remove ("ticks", "title", "text", and/or "line")

teach

print longer equivalent ggplot2 expression?

Details

easy_remove_x_axis and easy_remove_y_axis remove just the x or y axis, respectively.

Value

a theme object which can be used in ggplot2 calls

Author(s)

Alicia Schep

Examples


library(ggplot2)
# Remove all axes
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + easy_remove_axes()

# remove just x axis
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + easy_remove_x_axis()

# can also use:
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + easy_remove_axes("x")

# Remove y axis
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + easy_remove_y_axis()

# Remove just the ticks
# Remove y axis
ggplot(mtcars, aes(wt, mpg)) +
  geom_point() + easy_remove_y_axis(what = "ticks")

ggeasy documentation built on Nov. 3, 2024, 9:08 a.m.