r - Using Geom_Bar in GGplot2 -
so i'm trying use geom_bar in ggplot2, , of cases see of people demonstrating online of comparative frequencies of things. chart i'm trying stacked bar graph 1 
however, want vector of values. is, let's have vector
v=c(1,2,3,4) instead of 4 bars, understand get, i'd stack of 4 bars top 1 one unit tall, , next 1 down 2 units tall (etc.). possible in r?
edit: here code i've used graph. it's yielding normal bar graph, not stacked version i'm looking for:
ggplot(data = v, aes(x = factor(x), y = y)) + geom_bar(aes(fill = factor(y)),stat = 'identity')
i think can start this:
v=data.frame(x="my stacked bar", y=c(1,2,3,4)) ggplot(data = v, aes(x = factor(x), y = y))+ geom_bar(aes(fill=factor(y)), stat="identity")
Comments
Post a Comment