| Title: | Consistent Axis Tick Marks |
|---|---|
| Description: | This is a small package to provide consistent tick marks for plotting `ggplot2` figures. It provides breaks and labels for ggplot2 without requiring ggplot2 to be installed. |
| Authors: | Ben Williams [aut, cre] (ORCID: <https://orcid.org/0000-0001-7295-2076>) |
| Maintainer: | Benjamin C. Williams <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-06-02 10:13:37 UTC |
| Source: | https://github.com/ben-williams/tickr |
Adjust axis tick marks and labels
scale_x_tickr( ..., data, var, by = 5, var_min = NULL, var_max = NULL, lab_start = NULL, lab_end = NULL )scale_x_tickr( ..., data, var, by = 5, var_min = NULL, var_max = NULL, lab_start = NULL, lab_end = NULL )
... |
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 |
# Use with ggplot2 df <- data.frame(year = 1977:2023, value = rnorm(47)) library(ggplot2)# Use with ggplot2 df <- data.frame(year = 1977:2023, value = rnorm(47)) library(ggplot2)
Adjust axis tick marks and labels
scale_y_tickr( ..., data, var, by = 5, var_min = NULL, var_max = NULL, lab_start = NULL, lab_end = NULL )scale_y_tickr( ..., data, var, by = 5, var_min = NULL, var_max = NULL, lab_start = NULL, lab_end = NULL )
... |
= 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 |
# 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)# 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)
Adjust axis tick marks and labels
tickr( data, var, by = 5, var_min = NULL, var_max = NULL, lab_start = NULL, lab_end = NULL )tickr( data, var, by = 5, var_min = NULL, var_max = NULL, lab_start = NULL, lab_end = NULL )
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 |
A dataframe containing:
breaks |
Numeric vector of axis break positions |
labels |
Character vector of axis labels |
# Create sample data df <- data.frame(year = 1977:2023, value = rnorm(47)) # Basic usage tickr(data=df, var=year, by=5)# Create sample data df <- data.frame(year = 1977:2023, value = rnorm(47)) # Basic usage tickr(data=df, var=year, by=5)