R [ggplot2] How to set ticks size?

18,647

You may do:

ggplot(data, aes(x,y)) + 
    geom_point() + 
    theme(axis.ticks.length=unit(.25, "cm"))

This is from https://ggplot2.tidyverse.org/reference/theme.html

Share:
18,647
ZsideZ
Author by

ZsideZ

Updated on July 22, 2022

Comments

  • ZsideZ
    ZsideZ almost 2 years

    I'm trying to set ticks size, but when I specify axis.ticks parameter, ticks become horizontal on both axes. For example

    data <- data.frame(x =c(1:10), y = c(1:10) )
    ggplot(data, aes(x, y)) + 
      geom_point() +
      theme(axis.ticks = element_line(size = 5))
    

    http://prnt.sc/dlwv0i

    And angle parameter doesn't work.

    ggplot2 version 2.2.0.9000

    Any help would be appreciated.

  • ZsideZ
    ZsideZ over 7 years
    Thank you, the combination of axis.ticks.length and axis.ticks.size works perfectly