I'm trying to plot a basic bar chart outlining the count of values for each year. I'm not sure why the 'Year' is displaying in random order on the x axis? I would like to order the year by their sequential order.
Thanks!
Here is the code and the output plot. I have tried arranging the dataframe by Year and it did for the dataframe but doesn't change anything for the plot. Year is currently set as a "factor" data type.
data %>%
ggplot(aes(x=Year)) +
geom_bar()+
xlab("Year") +
ylab("Count")+
theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1))