Skip to contents

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

Usage

signs_centered(x, space = " ", encoding = "UTF-8", ...)

Arguments

x

a numeric vector

space

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

encoding

type of encoding (defaults to UTF-8)

...

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)