I have a dataframe that looks like this:
df <- read.table(text = "range count
<=30 2
30-40 6
50-60 8
>=60 5", header = T, sep="\t")
df
range count
<=30 2
30-40 6
50-60 8
>=60 5
I am trying to plot a line plot with ggplot2 with x axis having the order shown from top to bottom, but when I plot the graph , I get >=60 as the second entry on x axis. I want it as the last. What am I missing. Here is the code
ggplot(df, aes(x= range ,y=count, group = 1))+
geom_line(color="red") +
geom_point(color="black",fill = "red",shape=21)+
xlab("range")+ylab("count (%)")+
scale_y_continuous(limits =c(0,30),breaks = seq(0,30,5))