Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R [ggplot2] How to set ticks size?

Tags:

r

ggplot2

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.

like image 535
ZsideZ Avatar asked Dec 20 '16 21:12

ZsideZ


1 Answers

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

like image 186
MarBlo Avatar answered Oct 20 '22 00:10

MarBlo