Reputation: 85
I have graphed a histogram but for some reason the x labels are partial.
I want to have every year written on the x-axis. Here is my code:
ggplot(video_games, aes(x = Year)) + geom_histogram(stat = 'count') + lims(x = c(1995, 2017))
Upvotes: 0
Views: 2190
Reputation: 5232
You can try:
ggplot(video_games, aes(x = year)) +
geom_bar() +
scale_x_continuous(breaks = unique(video_games$year)) +
coord_flip()
coord_flip
is there because you will have a lot of 'long' labels on x-axis. If you dont want to flip you can rotate:
theme(axis.text.x = element_text(angle = 90, vjust = 0.5))
Upvotes: 1
Reputation: 1007
Try adding scale_x_continuous
with the breaks
argument:
ggplot(...) +
... +
scale_x_continuous(breaks = 1995:2016)
Upvotes: 1