Type: | Package |
Title: | Consistent Axis Tick Marks |
Version: | 1.0.2 |
Maintainer: | Benjamin C. Williams <kleheni@gmail.com> |
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. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
Imports: | ggplot2, magrittr, rlang |
RoxygenNote: | 7.3.2 |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
URL: | https://github.com/ben-williams/tickr |
NeedsCompilation: | no |
Packaged: | 2025-04-09 17:00:52 UTC; Ben.Williams |
Author: | Benjamin C. Williams
|
Repository: | CRAN |
Date/Publication: | 2025-04-10 14:30:05 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling 'rhs(lhs)'.
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
)
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 |
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)
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)
Adjust axis tick marks and labels
Description
Adjust axis tick marks and labels
Usage
tickr(
data,
var,
by = 5,
var_min = NULL,
var_max = NULL,
lab_start = NULL,
lab_end = NULL
)
Arguments
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
A dataframe containing:
breaks |
Numeric vector of axis break positions |
labels |
Character vector of axis labels |
Examples
# Create sample data
df <- data.frame(year = 1977:2023, value = rnorm(47))
# Basic usage
tickr(data=df, var=year, by=5)