knitr::opts_chunk$set( collapse = TRUE, comment = "#>", warning = FALSE, message = FALSE, fig.width = 7, fig.height = 6 )
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].
library(devtools) install_github("mayer79/prettybreaks")
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))
[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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.