Is it possible to remove the y axis ticks in geom_histogram?

66 Views Asked by At

As in the title, I am plotting a serials of facet plots of histograms. But I do not want the y axis ticks (counts/density) to show up since it looks cluttered. I used the option theme(axis.ticks.y = element_blank()) to remove the y axis ticks but it does not work for geom_histogram.

Here is a simple reproducible example:

dd <- data.frame(x = c(1:100))

ggplot(dd, aes(x)) + geom_histogram() + theme(axis.ticks.y = element_blank())

Is it just not possible to do this with histogram plots, or is there some other way? Any help would be awesome. Thank you!

1

There are 1 best solutions below

0
r2evans On BEST ANSWER

Add axis.text.y=element_blank() as well:

ggplot(dd, aes(x)) +
  geom_histogram() +
  theme(
    axis.ticks.y = element_blank(),
    axis.text.y = element_blank()
  )

ggplot with ticks and text removed