I am having problem to set x-axis, if someone can please let me know how I can set my x-axis from one to nine in ascending order. Here is code:
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 3.5.3
# Create a dataset
trend <- read.table(header = T, text = 'hedonic Category Percentage
one CATA 31
one OEQ 6
two CATA 0
two OEQ 0
three CATA 17
three OEQ 10
four CATA 13
four OEQ 0
five CATA 2
five OEQ 4
six CATA 6
six OEQ 13
seven CATA 31
seven OEQ 25
eight CATA 0
eight OEQ 25
nine CATA 0
nine OEQ 17')
ggplot(trend, aes(factor(hedonic), Percentage, fill=Category)) +
geom_bar(stat="identity", position = "dodge") + scale_fill_brewer(palette = "Set1")
Created on 2020-05-18 by the reprex package (v0.3.0)