knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  warning = FALSE,
  message = FALSE,
  fig.width = 7,
  fig.height = 6
)

Introduction

prettybreaks contains functions to create pretty breaks for numeric vectors.

Its main function pretty2() is similar to base::pretty() but allows to use different number systems and other tweaks, see examples below.

The algorithm is based on [1].

Installation

library(devtools)
install_github("mayer79/prettybreaks")

Examples

library(prettybreaks)

x <- 1:100

pretty2(x)                        

pretty2(x, n = 4)                 

pretty2(x, base = 5)              

pretty2(x, p = c(10/7, 20/7, 50/7))

References

[1] W. J. Dixon and R. A. Kronmal (1965). The choice of origin and scale for graphs. Journal of the ACM, 12(2):259-261.



mayer79/prettybreaks documentation built on Dec. 21, 2021, 3:53 p.m.