ggplot order months in x-axis

Set the levels of the factor variable, since you already have it ordered as you want, you can simply use forcats::fct_inorder()

See this example:

library(tidyverse)

# Sample data on a copy/paste friendly format
sample_df <- data.frame(stringsAsFactors = FALSE,
                        Month = c("Enero", "Febrero", "Marzo"),
                        Sales = c(1, 2, 3)
                        )
ggplot(sample_df) +
    geom_point(aes(x = fct_inorder(Month), y = Sales/10^1), size = 3) +
    ylab("New Sales in 2019") +
    xlab("Months in 2019") +
    ggtitle("Sales in The Company")

Created on 2020-04-18 by the reprex package (v0.3.0.9001)

Note: Next time, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

2 Likes