If the column names of a data.frame
are started with numbers, or have spaces, aes_string()
fails to handle them:
foo=data.frame(\"1
I had similar situation and I used `` to make it understand:
mydf$ROIs <- row.names(mydf)
df.long <- melt(mydf)
colnames(df.long)[3] <- "Methods"
colnames(df.long)[4] <- "Mean L2 Norm Error"
variable.name="Variable", na.rm=TRUE)
ggplot(df.long, aes(ROIs, `Mean L2 Norm Error`, fill=Methods))+
geom_bar(stat="identity",position="dodge")+
theme(axis.text.x=element_text(angle=45,hjust=1,vjust=1))