equal_breaks: Equal breaks for ggplot2 facets

View source: R/utils.R

equal_breaksR Documentation

Equal breaks for ggplot2 facets

Description

Equal breaks for ggplot2 facets

Usage

equal_breaks(n = 3, s = 0.05)

Arguments

n

Number of breaks

s

Scaling factor (cf. multiplicative expand)

Details

Code copied from: https://stackoverflow.com/questions/28436855/change-the-number-of-breaks-using-facet-grid-in-ggplot2

Examples


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))

PMassicotte/ggpmthemes documentation built on June 18, 2022, 7:12 a.m.