'Removing only a single tick mark from discrete x axis ggplot

I am trying to make a bar plot that shows predation rates across 3 different years (2018, 2020, 2021). Unfortunately, I don't have the 2019 data. When I try to make the bar plot, it's just showing 2019 as an empty space in the figure, which I'd like to get rid of.

What I've tried so far:

scale_x_discrete(name = 'Year', labels = c('2018', '', '2020', '2021'))

I've also tried playing around with limits = c('2018' = '2018', '2020' = '2020', '2021' = '2021' but to no avail.

Here is my code at the moment without those modifications:

ggplot(data = predation, aes(x = Year, y = X.predated, fill = Type.of.Habitat)) +
  geom_bar(stat = 'identity', position = position_dodge())

I have attached by full code and an image.barplot



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source