Quantcast
Channel: Increase number of axis ticks - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by Tung for Increase number of axis ticks

0
0

The upcoming version v3.3.0 of ggplot2 will have an option n.breaks to automatically generate breaks for scale_x_continuous and scale_y_continuous

    devtools::install_github("tidyverse/ggplot2")

    library(ggplot2)

    plt <- ggplot(mtcars, aes(x = mpg, y = disp)) +
      geom_point()

    plt + 
      scale_x_continuous(n.breaks = 5)

enter image description here

    plt + 
      scale_x_continuous(n.breaks = 10) +
      scale_y_continuous(n.breaks = 10)

enter image description here


Viewing all articles
Browse latest Browse all 7

Latest Images

Trending Articles





Latest Images