How can I control y-axis ticks and x-axis ticks independently in ggplot2?
ggplot2, r
Solution
To remove just x axis ticks use `axis.ticks.x=`
c <- ggplot(mtcars, aes(factor(cyl)))
c + geom_bar()+opts(axis.ticks.x=theme_blank())
For the latest ggplot2 version (0.9.3) instead of `opts()` use `theme()` and `element_blank()`.
c <- ggplot(mtcars, aes(factor(cyl)))
c + geom_bar()+theme(axis.ticks.x=element_blank())
Problem
I want to remove axis ticks from the x-axis without removing them from the y-axis. Right now, I can get both to be removed using: ``` axis.ticks=theme_blank() ``` For instance: ``` # Generate data c <- ggplot(mtcars, aes(factor(cyl))) c + geom_bar()+opts(axis.ticks=theme_blank()) #c + geom_bar(width=.5) #c + geom_bar() + coord_flip() #c + geom_bar(fill="white", colour="darkgreen") ``` But I don't know how to control them independently.