Single bar barchart in ggplot2, R -


i have following data , code:

> ddf   var1 var2 1   aa   73 2   bb   18 3   cc    9 >  > dput(ddf) structure(list(var1 = c("aa", "bb", "cc"), var2 = c(73l, 18l,  9l)), .names = c("var1", "var2"), class = "data.frame", row.names = c(na,  -3l)) >  >  > ggplot(ddf,aes(x=var1, y=var2, fill=var1))+ geom_bar(width=1, stat='identity') 

this creates barchart 3 bars. how can create single stacked bar data. want have these 3 bars stacked on top of each other rather being separate bars.

this you're looking for:

ggplot(ddf, aes(1, var2, fill=var1)) + geom_bar(stat="identity") 

you can't specify different x positions , asked them stacked @ same time. have specify they're on same x-position in order them on top of each other.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -