equal_breaks | R Documentation |
Equal breaks for ggplot2 facets
equal_breaks(n = 3, s = 0.05)
n |
Number of breaks |
s |
Scaling factor (cf. multiplicative expand) |
Code copied from: https://stackoverflow.com/questions/28436855/change-the-number-of-breaks-using-facet-grid-in-ggplot2
library(ggplot2) ggplot(mtcars, aes(x = disp, y = drat)) + geom_point() + facet_wrap(~cyl, scales = "free_x") + scale_x_continuous(breaks = equal_breaks(n = 4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.