I have a data, 64 rows, 3 columns as below. I want to fill each bar based on the colors
.
#Code Route1 colors
# 0 0.25 a
# 1 0.08 b
# 10 0.02 b
# 11 0.11 b
# 100 0.04 b
# 101 0.04 b
# 110 0.06 b
# 111 0.03 b
# 1000 0.02 c
# ... ... ...
#Character Numerical Factor
ggplot(mydata, aes(x = Code, y=Route1, fill=colors)) +
geom_bar(stat="identity", width=0.7)
The order of bars does not follow the column Code
.