Setting the x & y ticks to a sequential

Hi everyone,

I have a plot in which I'd like the xticks to be seq(0, 240, 24). I've tried many ways but surprisingly none of them worked.
If you got a solution, your help is much appreciated

Thanks :slightly_smiling_face::slightly_smiling_face:

Use the breaks argument to ggplot2::scale_x_continuous like so:

library(tidyverse)

mtcars %>% 
    ggplot(aes(x = disp, y = hp)) + 
    geom_point() +
    scale_x_continuous(
        breaks = seq( 
            from = 0, # Adjust the from, to, and by arguments as needed
            to = 500,
            by = 20
        )
    )

1 Like