signs_centered: centered signed numbers

View source: R/main.R

signs_centeredR Documentation

centered signed numbers

Description

A wrapper function for the signs::signs function. It adds a figure space to negative numbers so that it appear as if the minus sign does not affect the number's centering.

Usage

signs_centered(x, space = " ", ...)

Arguments

x

a numeric vector

space

a character to be added to negative numbers (defaults to a figure space)

...

parameters passed to signs:signs

Value

a vector of numbers converted to characters

Examples

library(ggplot2)
d <- data.frame(x = -4:0, y = -4:0)
# In these 2 plots, Compare the centering of the negative numbers on the x-axis
ggplot(d, aes(x,y))
ggplot(d, aes(x,y)) +
  scale_x_continuous(labels = signs_centered)

wjschne/WJSmisc documentation built on June 29, 2023, 8:04 a.m.