I'm trying to draw a vertical stacked bar plot in an ordered way as follows.
This is the code I had used.
setwd('d:/Dataset/lynda')
unitcounts<-read.csv('ucounts.csv',header=T,sep=',')
library(reshape2)
prodf<-melt(unitcounts,id.var = "Units")
attach(prodf)
library(ggplot2)
ggplot(prodf,aes(x=Units,y=value,fill=variable))+geom_bar(stat="identity")
prodf
This is the output I had got. Could someone help me to arrange the vertical bar orderly?
Units,Person1,Person2,Person3,Person4,Person5
Whatsits,54,64,31,43,47
Doohickeys,28,47,21,28,32
Gadgets,23,34,14,19,28
Bahbooms,0,0,0,0,0
Heehaws,0,0,0,0,0
Doodads,0,0,0,0,0
Meemaws,13,20,11,15,15
Watchamacalists,22,30,15,15,19