'Set breaks between values in continuous axis of ggplot

How can we set the breaks of continous axis every 2 numbers if we have a very big range of values in an axis and cannot set it manually?

p1 <- ggplot(mpg, aes(displ, hwy)) +
  geom_point()
p1 + scale_x_continuous(breaks = c(2, 4, 6))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source