I am plotting my data in ggplot and am trying to order x-axis of my plot but it doesn't work and I cant understand why. Here is my data test.txt
V1 V2 Count
a a1b15 2
a a1b8 7
a a3b9 9
a u1b10 11
a a2b19 2
b a5b12 1
b a1b13 5
b a1b14 10
b a1b17 15
c a1b16 16
c a1b17 17
a a1b18 5
a a2b11 10
d a1b20 15
d a1b25 16
plotd<-read.table("test.txt", header=TRUE)
ggplot(plotd,aes(x=fct_relevel(V2, "u1b10","a1b13","a1b14","a1b15","a1b16","a1b17","a1b17","a1b18","a1b20","a1b25","a1b8","a2b11","a2b19","a3b9","a5b12"), y=V1)) +
geom_tile(aes(fill=Count), width=0.3) +
geom_text(aes(label = Count), data=cbind(aggregate(Count~V1, plotd, sum), V1="Total"), size=10) +
geom_text(aes(label = Count), data=cbind(aggregate(Count~V2, plotd, sum), V2="Total"), size=10) +
scale_fill_gradient(low = "red", high = "dark red") +
theme(axis.text.x = element_text(angle = 60, hjust = 1), text=element_text(size=30)) +
scale_y_discrete(name="test", limits = rev(c(unique(as.character(plotd$V1)), 'Total')))+
scale_x_discrete(limits = c(unique(plotd$V2), "Total")) +
labs(x="Med", fill ="Count", Title= "med-test") +
geom_text(aes(label=plotd$Count), size=8)