gg_integer_breaks | R Documentation |
Calculates a vector of breaks that contains all integers between 0 and max(x) (with a little bit of extra headroom in case the maximum element is an integer)
gg_integer_breaks(x)
x |
The input vector for which the breaks should be calculated. Note that there is no fancy NSE here, the actual variable must be passed to the function, and also that the function currently does not handle negative data and will error out if passed such data. |
A vector of breaks suitable for use with ggplot
breaks parameter.
Other functions extending ggplot
:
gg_apply_labs()
,
gg_apply()
if ( require(ggplot2) ) {
ggplot(mtcars) +
aes(wt,drat) +
geom_point() +
scale_y_continuous(breaks=gg_integer_breaks(mtcars$drat))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.