scale_y_tickr: Adjust axis tick marks and labels

View source: R/tickr.R

scale_y_tickrR Documentation

Adjust axis tick marks and labels

Description

Adjust axis tick marks and labels

Usage

scale_y_tickr(
  ...,
  data,
  var,
  by = 5,
  var_min = NULL,
  var_max = NULL,
  lab_start = NULL,
  lab_end = NULL
)

Arguments

...

= other ggplot2::scale_y_continuous inputs

data

A dataframe containing the variable of interest

var

variable of interest (e.g., year)

by

step increase desired (e.g., every 5 years)

var_min

minimum value to adjust axis range

var_max

Maximum value to adjust axis range

lab_start

Lowest value to label

lab_end

Last value to label

Value

An object that can be added to a ggplot object

Examples

# Use with ggplot2
df <- data.frame(year = 1977:2023, value = rnorm(47))
library(ggplot2)
ggplot2::ggplot(data=df, ggplot2::aes(x = value, y = year)) +
  ggplot2::geom_line() +
  scale_y_tickr(data = df, var = year, by = 5)

tickr documentation built on April 12, 2025, 1:17 a.m.