get_breaks | R Documentation |
Set the breaks for a graph in nice positions.
get_breaks(
limits,
N = 10,
max_breaks = 10,
int_only = TRUE,
multiples_only = FALSE,
include_bounds = TRUE
)
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 |
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.
A sorted numerical vector with breaks of length |max_breaks|+2
when include_bounds
is TRUE
and of size |max_breaks|
otherwise.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.