even_lims: Set Even Limits Based on Data Values

Description Usage Arguments Value Examples

View source: R/even_lims.R

Description

This function takes a numeric vector and returns a range of the negative and positive of the element with the highest absolute value. The lower bound is rounded down to the next integer, the upper bound rounded up. It is intended to set even limits on plots when called on the breaks or data values corresponding to an aesthetic, and usefully always returns an interval containing 0.

Usage

1
even_lims(vec)

Arguments

vec

A vector, typically a row or column representing a dimension to plot

Value

A length 2 vector consisting of the negative and positive of the value of @param vec with the greatest absolute value, respectively rounded down and up.

Examples

1
2
# Create four-quadrant plot
library(ggplot2)

ryan-heslin/matador documentation built on Dec. 22, 2021, 8:17 p.m.