Change value labels on X-Axis using ggplot

May you please help me on how to change value labels on x--axis by using gglot?
For example: there are values including course 1 , course 2, course 3, course 4 on the x-axis of a bar chart using ggplot. I want to change the order of labels on x-axis: course 4, course 1, course 2, course 3.


You can make the x axis values into a factor and set the order of its levels.

DF <- data.frame(Prgm=c("course 1", "course 2", "course 3", "course 4"),
DF$Prgm <- factor(DF$Prgm, levels = c("course 4", "course 1", "course 2", "course 3"))
ggplot(DF,aes(Prgm,Value)) + geom_col()

Created on 2022-01-04 by the reprex package (v2.0.1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.