Hi,
Sorry for maybe posting at the wrong place...
I wanted to create a very similar thing and I have tried the script
you wrote, however my plot gets really weird. I though it was because
some of y values for x was missing, but when entering the mean value
in those places the plot looks the same...
Anyhow, this is how my data looks like;
https://www.dropbox.com/s/b7kghckpph37jlb/ao_percent_class.txt
What I run is;
> ao=read.table('ao_percent_class.txt', sep="", header=F)
> names(ao)=c("Class","3","4","5","6","7","8","9","10","11","12","1","2")
> ao.m=melt(ao)
Using Class as id variables
> names(ao.m)=c("class", "month", "r.abu")
> ao.m$month=as.numeric(ao.m$month)
> ggplot(ao.m, aes(x=month, y=r.abu, fill=class, na.rm=FALSE)) +
+ geom_area(colour="black") +
+ geom_linerange(aes(ymax=r.abu), ymin=0, position="stack") +
+ scale_x_continuous(breaks=1:max(ao.m$month), labels=levels(ao.m
$month))
Thanks for any help!
Cheers
Johannes
> <
a.miren...@googlemail.com>wrote:
>
>
>
>
>
>
>
> > Brandon, thanks for your reply anyway!
>
> > 2012/5/15 Brandon Hurr <
brandon.h...@gmail.com>
>
> >> Thanks for the example and mockup. You're right that the width of the
> >> geom_area output is limited to the means of the data so they won't connect
> >> to the edges of the bars like you want.
>
> >> I wish I had a better idea if you could hack the area output to the width
> >> of the bars, but that would need to be answered by someone with greater
> >> knowledge of the guts like Hadley, Takahashi-san or Winston.
>
> >> On Tue, May 15, 2012 at 4:06 PM, Anja Mirenska <
a.miren...@googlemail.com
> >> > wrote:
>
> >>> Ok, here is a data example:
>
> >>> groups <- c("Group1", "Group2", "Group3", "Group1", "Group2", "Group3",
> >>> "Group1", "Group2", "Group3")
> >>> variable <- c("Var16", "Var16", "Var16", "Var32", "Var32", "Var32",
> >>> "Var35", "Var35", "Var35")
> >>> value <- c(21.1, 13, 5, 39.6, 3.7, 10.4, 21.7, 1, 30)
> >>> df <- data.frame(groups, variable, value)
>
> >>> I attached a bar plot that I modified with a graphic program to indicate
> >>> approximately what I mean. For sure this picture is not perfect, as e.g. I
> >>> would like the bars to be thinner etc., but I hope you get the idea.
>
> >>> 2012/5/15 Brandon Hurr <
brandon.h...@gmail.com>
> connectbars.png
> 14 KVerDescargar