As a simple example I am going to use the diamonds data:
data(diamonds)
ggplot(diamonds, aes(x = clarity, y = carat, fill = cut)) +
geom_bar(stat = "identity")
This will give me the following output, where the x axis is not annotated:
How do I make the values of the x- and y-axis appear? I have been searching wide and far and haven't yet found a solution...
For my real dataset, my x-axis values are discrete, and using scale_x_discrete() does not change the outcome.
Thank in advance!
Your code works fine, I believe you must update ggplot2
and start a new R
session:
data(diamonds)
ggplot(diamonds, aes(x = clarity, y = carat, fill = cut)) +
geom_bar(stat = "identity")