Basically, I’m looking for a way to remove x-axis label in some given facets.
In this case, remove the x.axis labels every other facet. I searched around but didn’t find any viable solution. Thanks!

Desired output

Sample data and code

library(tidyverse) dat <- structure(list(Year = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L), .Label = c("2001", "2002", "2003"), class = "factor"), Company = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L), .Label = c("AAA", "BBB", "CCC", "DDD"), class = "factor"), Rank = c(1, 3, 2, 4, 5, 4, 2, 3, 2, 3, 5, 1), Rank_rev = c(5, 3, 4, 2, 1, 2, 4, 3, 4, 3, 1, 5)), class = c("data.frame"), row.names = c(NA, -12L)) dat <- dat %>% mutate(Company = factor(Company), Year = factor(Year), Rank_rev = max(Rank) - Rank + 1) myplot <- ggplot(dat, aes(x = Year, y = Rank_rev)) + facet_grid(.~ Company) + geom_col(aes(fill = Company)) + geom_text( aes(x = Year, y = Rank_rev, label = Rank), nudge_y = 0.25, size = 5, hjust = 0.5, color = "black") + scale_fill_brewer(palette = "Set2") + scale_x_discrete(expand = c(0, 0)) + scale_y_continuous(expand = expand_scale(mult = c(0, 0.1))) + theme_minimal() + theme(axis.text.y = element_blank()) myplot

You are watching: Ggplot: How to remove axis labels on selected facets only?. Info created by GBee English Center selection and synthesis along with other related topics.