Current answers are either incomplete or inefficient. Here is (perhaps) the shortest way to achieve the outcome (using theme_void()
:
data(diamonds) # Data example
ggplot(data = diamonds, mapping = aes(x = clarity)) + geom_bar(aes(fill = cut)) +
theme_void() + theme(legend.position="none")
The outcome is:
If you are interested in just eliminating the labels, labs(x="", y="")
does the trick:
ggplot(data = diamonds, mapping = aes(x = clarity)) + geom_bar(aes(fill = cut)) +
labs(x="", y="")