Learn R Programming

tickr (version 1.0.2)

scale_x_tickr: Adjust axis tick marks and labels

Description

Adjust axis tick marks and labels

Usage

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

Value

An object that can be added to a ggplot object

Arguments

...

other ggplot2::scale_x_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

Examples

Run this code
# Use with ggplot2
df <- data.frame(year = 1977:2023, value = rnorm(47))
library(ggplot2)

Run the code above in your browser using DataLab