util_int_breaks_rounded {dataquieR}R Documentation

Integer breaks for ggplot2

Description

creates integer-only breaks

Usage

util_int_breaks_rounded(x, n = 5)

Arguments

x

the values

n

integer giving the desired number of intervals. Non-integer values are rounded down.

Value

breaks suitable for ⁠scale_*_continuous⁠' breaks argument

Author(s)

Sarah

See Also

StackOverflow

Examples

## Not run: 
big_numbers1 <- data.frame(x = 1:5, y = c(0:1, 0, 1, 0))
big_numbers2 <- data.frame(x = 1:5, y = c(0:1, 0, 1, 0) + 1000000)

big_numbers_plot1 <- ggplot(big_numbers1, aes(x = x, y = y)) +
  geom_point()

big_numbers_plot2 <- ggplot(big_numbers2, aes(x = x, y = y)) +
  geom_point()

big_numbers_plot1 + scale_y_continuous()
big_numbers_plot1 + scale_y_continuous(breaks = util_int_breaks_rounded)

big_numbers_plot2 + scale_y_continuous()
big_numbers_plot2 + scale_y_continuous(breaks = util_int_breaks_rounded)

## End(Not run)


[Package dataquieR version 2.5.1 Index]