Is there a way to sort data day-wise instead of by the increasing/decreasing order of values? The data is basically as below.
Day n
Friday 12
Monday 25
Saturday 18
Sunday 14
Below is the graph for the data plot. I want it to appear in the order Monday-Sunday.
Please help.
FJCC
2
You need to make your Day column a factor with the levels set in the order that you want them on the x axis. Here is an example with just four days.
library(ggplot2)
DF <- data.frame(Day = c("Friday", "Monday", "Sunday", "Saturday"),
n = c(23,18,28,21))
DF$Day <- factor(DF$Day, levels = c("Monday", "Friday", "Saturday", "Sunday"))
ggplot(DF, aes(Day, n)) + geom_col(fill = "steelblue")
system
Closed
3
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.