I need to reorder a barplot from high to low (left to right) using ggplot & aes_string(). For e.g. for a dataframe df <- f(X,Y,Z) this can be done with
g
Since aes_string works with strings, use paste:
aes_string
paste
ggplot(top10, aes_string(x=paste0("reorder(",colnames(top10)[num1],", -Y)"),y=meanFeat, fill=colnames(top10)[num1])) + geom_bar(stat="identity")