get_breaks {hgutils} | R Documentation |
Create nice axis breaks for plots
Description
Set the breaks for a graph in nice positions.
Usage
get_breaks(
limits,
N = 10,
max_breaks = 10,
int_only = TRUE,
multiples_only = FALSE,
include_bounds = TRUE
)
ggplot_breaks(...)
Arguments
limits |
axis limits. May be either a vector of 2 elements with lower and upper bounds, or a single number (which is the upper bound, the lower bound is then assumed to be 0). |
N |
step size. The eventual intervals will be multiples of the divisors of |
max_breaks |
maximum amount of breaks, defaults to 10. |
int_only |
whether only integer divisors of |
multiples_only |
whether only multiples of |
include_bounds |
whether the resulting breaks should encompass |
... |
Arguments passed on to |
Details
get_breaks
is the base function and creates a vector of breaks ggplot_breaks
is a wrapper and
makes usage easier in ggplot2. The limits of the axis may not be known beforehand,
but ggplot_breaks
receives it from ggplot
and then creates nice breaks.
Value
A sorted numerical vector with breaks of length |max_breaks|+2
when include_bounds
is TRUE
and of size |max_breaks|
otherwise.
Examples
get_breaks(24, N=12, max_breaks=15)
## Not run:
ggplot() + scale_x_continuous(breaks = ggplot_breaks(N=12, max_breaks=15))
## End(Not run)